9 #ifndef Tempus_StepperIMEX_RK_Partition_impl_hpp
10 #define Tempus_StepperIMEX_RK_Partition_impl_hpp
12 #include "Thyra_VectorStdOps.hpp"
14 #include "Tempus_StepperFactory.hpp"
19 template <
class Scalar>
21 std::string stepperType)
24 stepperType !=
"Partitioned IMEX RK 1st order" &&
25 stepperType !=
"Partitioned IMEX RK SSP2" &&
26 stepperType !=
"Partitioned IMEX RK ARS 233" &&
27 stepperType !=
"General Partitioned IMEX RK",
32 <<
" does not match one of the types for this Stepper:\n"
33 <<
" 'Partitioned IMEX RK 1st order'\n"
34 <<
" 'Partitioned IMEX RK SSP2'\n"
35 <<
" 'Partitioned IMEX RK ARS 233'\n"
36 <<
" 'General Partitioned IMEX RK'\n");
38 this->setStepperName(
"Partitioned IMEX RK SSP2");
39 this->setStepperType(
"Partitioned IMEX RK SSP2");
40 this->setUseFSAL(
false);
41 this->setICConsistency(
"None");
42 this->setICConsistencyCheck(
false);
43 this->setZeroInitialGuess(
false);
45 this->setStageNumber(-1);
47 this->setTableaus(stepperType);
48 this->setAppAction(Teuchos::null);
49 this->setDefaultSolver();
52 template <
class Scalar>
56 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
57 bool zeroInitialGuess,
59 std::string stepperType,
64 stepperType !=
"Partitioned IMEX RK 1st order" &&
65 stepperType !=
"Partitioned IMEX RK SSP2" &&
66 stepperType !=
"Partitioned IMEX RK ARS 233" &&
67 stepperType !=
"General Partitioned IMEX RK",
72 <<
" does not match one of the types for this Stepper:\n"
73 <<
" 'Partitioned IMEX RK 1st order'\n"
74 <<
" 'Partitioned IMEX RK SSP2'\n"
75 <<
" 'Partitioned IMEX RK ARS 233'\n"
76 <<
" 'General Partitioned IMEX RK'\n");
78 this->setStepperName(stepperType);
79 this->setStepperType(stepperType);
80 this->setUseFSAL(useFSAL);
81 this->setICConsistency(ICConsistency);
82 this->setICConsistencyCheck(ICConsistencyCheck);
83 this->setZeroInitialGuess(zeroInitialGuess);
84 this->setOrder(order);
86 this->setStageNumber(-1);
88 if (stepperType ==
"General Partitioned IMEX RK") {
89 this->setExplicitTableau(explicitTableau);
90 this->setImplicitTableau(implicitTableau);
93 this->setTableaus(stepperType);
95 this->setAppAction(stepperRKAppAction);
96 this->setSolver(solver);
98 if (appModel != Teuchos::null) {
99 this->setModel(appModel);
104 template <
class Scalar>
106 std::string stepperType,
110 if (stepperType ==
"") stepperType =
"Partitioned IMEX RK SSP2";
112 if (stepperType ==
"Partitioned IMEX RK 1st order") {
120 const Scalar one = ST::one();
121 const Scalar zero = ST::zero();
140 "Explicit Tableau - Partitioned IMEX RK 1st order", A, b, c, order,
142 expTableau->setTVD(
true);
143 expTableau->setTVDCoeff(2.0);
145 this->setExplicitTableau(expTableau);
151 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
155 const Scalar one = ST::one();
156 const Scalar zero = ST::zero();
175 "Implicit Tableau - Partitioned IMEX RK 1st order", A, b, c, order,
177 impTableau->setTVD(
true);
178 impTableau->setTVDCoeff(sspcoef);
180 this->setImplicitTableau(impTableau);
182 this->setStepperName(
"Partitioned IMEX RK 1st order");
183 this->setStepperType(
"Partitioned IMEX RK 1st order");
186 else if (stepperType ==
"Partitioned IMEX RK SSP2") {
189 this->setExplicitTableau(stepperERK->getTableau());
193 stepperSDIRK->setGammaType(
"2nd Order L-stable");
194 this->setImplicitTableau(stepperSDIRK->getTableau());
196 this->setStepperName(
"Partitioned IMEX RK SSP2");
197 this->setStepperType(
"Partitioned IMEX RK SSP2");
200 else if (stepperType ==
"Partitioned IMEX RK ARS 233") {
206 const Scalar one = ST::one();
207 const Scalar zero = ST::zero();
208 const Scalar onehalf = ST::one() / (2 * ST::one());
209 const Scalar gamma = (3 * one + ST::squareroot(3 * one)) / (6 * one);
219 A(2, 0) = (gamma - 1.0);
220 A(2, 1) = (2.0 - 2.0 * gamma);
236 "Explicit Tableau - Partitioned IMEX RK ARS 233", A, b, c, order,
239 this->setExplicitTableau(expTableau);
251 A(2, 1) = (1.0 - 2.0 * gamma);
267 "Implicit Tableau - Partitioned IMEX RK ARS 233", A, b, c, order,
270 this->setImplicitTableau(impTableau);
272 this->setStepperName(
"Partitioned IMEX RK ARS 233");
273 this->setStepperType(
"Partitioned IMEX RK ARS 233");
276 else if (stepperType ==
"General Partitioned IMEX RK") {
277 if (explicitTableau == Teuchos::null) {
280 this->setExplicitTableau(stepperERK->getTableau());
283 this->setExplicitTableau(explicitTableau);
286 if (implicitTableau == Teuchos::null) {
290 stepperSDIRK->setGammaType(
"2nd Order L-stable");
291 this->setImplicitTableau(stepperSDIRK->getTableau());
294 this->setImplicitTableau(implicitTableau);
297 this->setStepperName(
"General Partitioned IMEX RK");
298 this->setStepperType(
"General Partitioned IMEX RK");
303 true, std::logic_error,
304 "Error - Not a valid StepperIMEX_RK_Partition type! Stepper Type = "
305 << stepperType <<
"\n"
306 <<
" Current valid types are: \n"
307 <<
" 'Partitioned IMEX RK 1st order'\n"
308 <<
" 'Partitioned IMEX RK SSP2'\n"
309 <<
" 'Partitioned IMEX RK ARS 233'\n"
310 <<
" 'General Partitioned IMEX RK'\n");
314 explicitTableau_ == Teuchos::null, std::runtime_error,
315 "Error - StepperIMEX_RK_Partition - Explicit tableau is null!");
317 implicitTableau_ == Teuchos::null, std::runtime_error,
318 "Error - StepperIMEX_RK_Partition - Implicit tableau is null!");
320 explicitTableau_->numStages() != implicitTableau_->numStages(),
322 "Error - StepperIMEX_RK_Partition - Number of stages do not match!\n"
323 <<
" Explicit tableau = " << explicitTableau_->description() <<
"\n"
324 <<
" number of stages = " << explicitTableau_->numStages() <<
"\n"
325 <<
" Implicit tableau = " << implicitTableau_->description() <<
"\n"
326 <<
" number of stages = " << implicitTableau_->numStages()
329 this->isInitialized_ =
false;
332 template <
class Scalar>
337 if (stepperType ==
"") {
338 if (pl == Teuchos::null)
339 stepperType =
"Partitioned IMEX RK SSP2";
342 pl->
get<std::string>(
"Stepper Type",
"Partitioned IMEX RK SSP2");
345 if (stepperType !=
"General Partitioned IMEX RK") {
346 this->setTableaus(stepperType);
349 if (pl != Teuchos::null) {
352 if (pl->
isSublist(
"IMEX-RK Explicit Stepper")) {
353 RCP<Teuchos::ParameterList> explicitPL =
355 pl->
sublist(
"IMEX-RK Explicit Stepper")));
357 auto stepperTemp = sf->createStepper(explicitPL, Teuchos::null);
361 stepperERK == Teuchos::null, std::logic_error,
362 "Error - The explicit component of a general partitioned IMEX RK "
363 "stepper was not specified as an ExplicitRK stepper");
364 explicitTableau = stepperERK->getTableau();
367 if (pl->
isSublist(
"IMEX-RK Implicit Stepper")) {
368 RCP<Teuchos::ParameterList> implicitPL =
370 pl->
sublist(
"IMEX-RK Implicit Stepper")));
372 auto stepperTemp = sf->createStepper(implicitPL, Teuchos::null);
376 stepperDIRK == Teuchos::null, std::logic_error,
377 "Error - The implicit component of a general partitioned IMEX RK "
378 "stepper was not specified as an DIRK stepper");
379 implicitTableau = stepperDIRK->getTableau();
383 !(explicitTableau != Teuchos::null &&
384 implicitTableau != Teuchos::null),
386 "Error - A parameter list was used to setup a general partitioned "
387 "IMEX RK stepper, but did not "
388 "specify both an explicit and an implicit tableau!\n");
390 this->setTableaus(stepperType, explicitTableau, implicitTableau);
392 this->setOrder(pl->
get<
int>(
"overall order", 1));
397 template <
class Scalar>
402 explicitTableau->isImplicit() ==
true, std::logic_error,
403 "Error - Received an implicit Tableau for setExplicitTableau()!\n"
404 <<
" Tableau = " << explicitTableau->description() <<
"\n");
405 explicitTableau_ = explicitTableau;
407 this->isInitialized_ =
false;
410 template <
class Scalar>
415 implicitTableau->isDIRK() !=
true, std::logic_error,
416 "Error - Did not receive a DIRK Tableau for setImplicitTableau()!\n"
417 <<
" Tableau = " << implicitTableau->description() <<
"\n");
418 implicitTableau_ = implicitTableau;
420 this->isInitialized_ =
false;
423 template <
class Scalar>
428 using Teuchos::rcp_const_cast;
429 using Teuchos::rcp_dynamic_cast;
430 RCP<Thyra::ModelEvaluator<Scalar> > ncModel =
432 RCP<WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> > modelPairIMEX =
436 modelPairIMEX == Teuchos::null, std::logic_error,
437 "Error - StepperIMEX_RK::setModel() was given a ModelEvaluator that\n"
438 <<
" could not be cast to a WrapperModelEvaluatorPairPartIMEX_Basic!\n"
439 <<
" From: " << appModel <<
"\n To : " << modelPairIMEX
440 <<
"\n Likely have given the wrong ModelEvaluator to this Stepper.\n");
442 setModelPair(modelPairIMEX);
444 this->isInitialized_ =
false;
452 template <
class Scalar>
458 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
460 this->wrapperModel_);
463 wrapperModelPairPartIMEX = mePairIMEX;
464 wrapperModelPairPartIMEX->initialize();
466 this->wrapperModel_ = wrapperModelPairPartIMEX;
468 this->isInitialized_ =
false;
476 template <
class Scalar>
483 this->wrapperModel_ =
485 explicitModel, implicitModel));
487 this->isInitialized_ =
false;
490 template <
class Scalar>
494 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
496 this->wrapperModel_);
498 wrapperModelPairPartIMEX == Teuchos::null, std::logic_error,
499 "Error - Can not cast the wrapper Model Evaluator to a IMEX Model Pair."
500 "StepperIMEX_RK_Partition::initialize()\n");
503 const int numStages = explicitTableau_->numStages();
504 stageF_.resize(numStages);
505 stageGx_.resize(numStages);
506 for (
int i = 0; i < numStages; i++) {
507 stageF_[i] = Thyra::createMember(
508 wrapperModelPairPartIMEX->getExplicitModel()->get_f_space());
509 stageGx_[i] = Thyra::createMember(
510 wrapperModelPairPartIMEX->getImplicitModel()->get_f_space());
515 xTilde_ = Thyra::createMember(
516 wrapperModelPairPartIMEX->getImplicitModel()->get_x_space());
522 template <
class Scalar>
528 int numStates = solutionHistory->getNumStates();
531 numStates < 1, std::logic_error,
532 "Error - setInitialConditions() needs at least one SolutionState\n"
533 " to set the initial condition. Number of States = "
537 RCP<Teuchos::FancyOStream> out = this->getOStream();
538 Teuchos::OSTab ostab(out, 1,
"StepperIMEX_RK::setInitialConditions()");
539 *out <<
"Warning -- SolutionHistory has more than one state!\n"
540 <<
"Setting the initial conditions on the currentState.\n"
544 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
545 RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
548 auto inArgs = this->wrapperModel_->getNominalValues();
549 if (x == Teuchos::null) {
551 (x == Teuchos::null) && (inArgs.get_x() == Teuchos::null),
553 "Error - setInitialConditions() needs the ICs from the "
554 "SolutionHistory\n or getNominalValues()!\n");
557 initialState->setX(x);
561 std::string icConsistency = this->getICConsistency();
563 icConsistency !=
"None", std::logic_error,
564 "Error - setInitialConditions() requested a consistency of '"
566 <<
"'.\n But only 'None' is available for IMEX-RK!\n");
569 this->getUseFSAL(), std::logic_error,
570 "Error - The First-Same-As-Last (FSAL) principle is not "
571 <<
"available for IMEX-RK. Set useFSAL=false.\n");
574 template <
typename Scalar>
578 Scalar stepSize, Scalar stageNumber,
583 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
585 this->wrapperModel_);
586 MEB::InArgs<Scalar> inArgs = wrapperModelPairPartIMEX->getInArgs();
588 inArgs.set_p(wrapperModelPairPartIMEX->getParameterIndex(), Y);
589 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
590 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
591 if (inArgs.supports(MEB::IN_ARG_stage_number))
592 inArgs.set_stage_number(stageNumber);
599 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
601 MEB::OutArgs<Scalar> outArgs = wrapperModelPairPartIMEX->getOutArgs();
604 wrapperModelPairPartIMEX->getImplicitModel()->evalModel(inArgs, outArgs);
605 Thyra::Vt_S(G.ptr(), -1.0);
608 template <
typename Scalar>
611 Scalar stepSize, Scalar stageNumber,
617 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
619 this->wrapperModel_);
620 MEB::InArgs<Scalar> inArgs =
621 wrapperModelPairPartIMEX->getExplicitModel()->createInArgs();
623 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
624 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
625 if (inArgs.supports(MEB::IN_ARG_stage_number))
626 inArgs.set_stage_number(stageNumber);
633 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
635 MEB::OutArgs<Scalar> outArgs =
636 wrapperModelPairPartIMEX->getExplicitModel()->createOutArgs();
639 wrapperModelPairPartIMEX->getExplicitModel()->evalModel(inArgs, outArgs);
640 Thyra::Vt_S(F.ptr(), -1.0);
643 template <
class Scalar>
647 this->checkInitialized();
653 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperIMEX_RK_Partition::takeStep()");
656 solutionHistory->getNumStates() < 2, std::logic_error,
657 "Error - StepperIMEX_RK_Partition<Scalar>::takeStep(...)\n"
658 <<
"Need at least two SolutionStates for IMEX_RK_Partition.\n"
659 <<
" Number of States = " << solutionHistory->getNumStates()
660 <<
"\nTry setting in \"Solution History\" \"Storage Type\" = "
661 <<
"\"Undo\"\n or \"Storage Type\" = \"Static\" and \"Storage Limit\" = "
664 RCP<SolutionState<Scalar> > currentState =
665 solutionHistory->getCurrentState();
666 RCP<SolutionState<Scalar> > workingState =
667 solutionHistory->getWorkingState();
668 const Scalar dt = workingState->getTimeStep();
669 const Scalar time = currentState->getTime();
671 const int numStages = explicitTableau_->numStages();
672 const SerialDenseMatrix<int, Scalar>& AHat = explicitTableau_->A();
673 const SerialDenseVector<int, Scalar>& bHat = explicitTableau_->b();
674 const SerialDenseVector<int, Scalar>& cHat = explicitTableau_->c();
675 const SerialDenseMatrix<int, Scalar>& A = implicitTableau_->A();
676 const SerialDenseVector<int, Scalar>& b = implicitTableau_->b();
677 const SerialDenseVector<int, Scalar>& c = implicitTableau_->c();
680 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
682 this->wrapperModel_);
685 Thyra::assign(workingState->getX().ptr(), *(currentState->getX()));
686 RCP<Thyra::VectorBase<Scalar> > stageY =
687 wrapperModelPairPartIMEX->getExplicitOnlyVector(workingState->getX());
688 RCP<Thyra::VectorBase<Scalar> > stageX =
689 wrapperModelPairPartIMEX->getIMEXVector(workingState->getX());
691 RCP<StepperIMEX_RK_Partition<Scalar> > thisStepper =
692 Teuchos::rcpFromRef(*
this);
693 this->stepperRKAppAction_->execute(
694 solutionHistory, thisStepper,
698 for (
int i = 0; i < numStages; ++i) {
699 this->setStageNumber(i);
701 Thyra::assign(stageY.ptr(),
702 *(wrapperModelPairPartIMEX->getExplicitOnlyVector(
703 currentState->getX())));
706 *(wrapperModelPairPartIMEX->getIMEXVector(currentState->getX())));
707 for (
int j = 0; j < i; ++j) {
709 RCP<Thyra::VectorBase<Scalar> > stageFy =
710 wrapperModelPairPartIMEX->getExplicitOnlyVector(stageF_[j]);
711 RCP<Thyra::VectorBase<Scalar> > stageFx =
712 wrapperModelPairPartIMEX->getIMEXVector(stageF_[j]);
713 Thyra::Vp_StV(stageY.ptr(), -dt * AHat(i, j), *stageFy);
714 Thyra::Vp_StV(xTilde_.ptr(), -dt * AHat(i, j), *stageFx);
717 Thyra::Vp_StV(xTilde_.ptr(), -dt * A(i, j), *(stageGx_[j]));
720 this->stepperRKAppAction_->execute(
721 solutionHistory, thisStepper,
724 Scalar ts = time + c(i) * dt;
725 Scalar tHats = time + cHat(i) * dt;
728 bool isNeeded =
false;
729 for (
int k = i + 1; k < numStages; ++k)
730 if (A(k, i) != 0.0) isNeeded =
true;
731 if (b(i) != 0.0) isNeeded =
true;
732 if (isNeeded ==
false) {
737 Thyra::assign(stageX.ptr(), *xTilde_);
738 evalImplicitModelExplicitly(stageX, stageY, ts, dt, i, stageGx_[i]);
743 const Scalar alpha = Scalar(1.0) / (dt * A(i, i));
744 const Scalar beta = Scalar(1.0);
747 RCP<TimeDerivative<Scalar> > timeDer =
749 alpha, xTilde_.getConst()));
754 this->stepperRKAppAction_->execute(
755 solutionHistory, thisStepper,
758 wrapperModelPairPartIMEX->setUseImplicitModel(
true);
759 this->solver_->setModel(wrapperModelPairPartIMEX);
762 if (wrapperModelPairPartIMEX->getParameterIndex() >= 0)
763 sStatus = this->solveImplicitODE(
764 stageX, stageGx_[i], ts, p, stageY,
765 wrapperModelPairPartIMEX->getParameterIndex());
767 sStatus = this->solveImplicitODE(stageX, stageGx_[i], ts, p);
771 wrapperModelPairPartIMEX->setUseImplicitModel(
false);
773 this->stepperRKAppAction_->execute(
774 solutionHistory, thisStepper,
778 Thyra::V_StVpStV(stageGx_[i].ptr(), -alpha, *stageX, alpha, *xTilde_);
781 this->stepperRKAppAction_->execute(
782 solutionHistory, thisStepper,
784 evalExplicitModel(workingState->getX(), tHats, dt, i, stageF_[i]);
785 this->stepperRKAppAction_->execute(
786 solutionHistory, thisStepper,
792 Thyra::assign((workingState->getX()).ptr(), *(currentState->getX()));
793 RCP<Thyra::VectorBase<Scalar> > Z = workingState->getX();
794 RCP<Thyra::VectorBase<Scalar> > X =
795 wrapperModelPairPartIMEX->getIMEXVector(Z);
796 for (
int i = 0; i < numStages; ++i) {
798 Thyra::Vp_StV(Z.ptr(), -dt * bHat(i), *(stageF_[i]));
800 Thyra::Vp_StV(X.ptr(), -dt * b(i), *(stageGx_[i]));
807 workingState->setOrder(this->getOrder());
808 workingState->computeNorms(currentState);
809 this->stepperRKAppAction_->execute(
810 solutionHistory, thisStepper,
814 this->setStageNumber(-1);
824 template <
class Scalar>
833 template <
class Scalar>
842 out <<
"--- StepperIMEX_RK_Partition ---\n";
843 out <<
" explicitTableau_ = " << explicitTableau_ << std::endl;
845 explicitTableau_->describe(out, verbLevel);
846 out <<
" implicitTableau_ = " << implicitTableau_ << std::endl;
848 implicitTableau_->describe(out, verbLevel);
849 out <<
" xTilde_ = " << xTilde_ << std::endl;
850 out <<
" stageF_.size() = " << stageF_.size() << std::endl;
851 int numStages = stageF_.size();
852 for (
int i = 0; i < numStages; ++i)
853 out <<
" stageF_[" << i <<
"] = " << stageF_[i] << std::endl;
854 out <<
" stageGx_.size() = " << stageGx_.size() << std::endl;
855 numStages = stageGx_.size();
856 for (
int i = 0; i < numStages; ++i)
857 out <<
" stageGx_[" << i <<
"] = " << stageGx_[i] << std::endl;
858 out <<
" stepperRKAppAction_= " << this->stepperRKAppAction_ << std::endl;
859 out <<
" order_ = " << order_ << std::endl;
860 out <<
"--------------------------------" << std::endl;
863 template <
class Scalar>
869 bool isValidSetup =
true;
875 this->wrapperModel_);
877 if (wrapperModelPairIMEX->getExplicitModel() == Teuchos::null) {
878 isValidSetup =
false;
879 out <<
"The explicit ModelEvaluator is not set!\n";
882 if (wrapperModelPairIMEX->getImplicitModel() == Teuchos::null) {
883 isValidSetup =
false;
884 out <<
"The implicit ModelEvaluator is not set!\n";
887 if (this->wrapperModel_ == Teuchos::null) {
888 isValidSetup =
false;
889 out <<
"The wrapper ModelEvaluator is not set!\n";
892 if (this->solver_ == Teuchos::null) {
893 isValidSetup =
false;
894 out <<
"The solver is not set!\n";
897 if (this->stepperRKAppAction_ == Teuchos::null) {
898 isValidSetup =
false;
899 out <<
"The AppAction is not set!\n";
902 if (explicitTableau_ == Teuchos::null) {
903 isValidSetup =
false;
904 out <<
"The explicit tableau is not set!\n";
907 if (implicitTableau_ == Teuchos::null) {
908 isValidSetup =
false;
909 out <<
"The implicit tableau is not set!\n";
915 template <
class Scalar>
919 auto pl = this->getValidParametersBasicImplicit();
920 pl->template set<int>(
"overall order", this->getOrder());
923 explicitStepper->setTableau(
924 explicitTableau_->A(), explicitTableau_->b(), explicitTableau_->c(),
925 explicitTableau_->order(), explicitTableau_->orderMin(),
926 explicitTableau_->orderMax(), explicitTableau_->bstar());
927 pl->set(
"IMEX-RK Explicit Stepper", *explicitStepper->getValidParameters());
930 implicitStepper->setTableau(
931 implicitTableau_->A(), implicitTableau_->b(), implicitTableau_->c(),
932 implicitTableau_->order(), implicitTableau_->orderMin(),
933 implicitTableau_->orderMax(), implicitTableau_->bstar());
934 pl->set(
"IMEX-RK Implicit Stepper", *implicitStepper->getValidParameters());
941 template <
class Scalar>
948 stepper->setStepperImplicitValues(pl);
949 stepper->setTableausPartition(pl, stepperType);
951 if (model != Teuchos::null) {
952 stepper->setModel(model);
953 stepper->initialize();
960 #endif // Tempus_StepperIMEX_RK_Partition_impl_hpp
Explicit Runge-Kutta time stepper.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
StepperIMEX_RK_Partition(std::string stepperType="Partitioned IMEX RK SSP2")
Default constructor.
T & get(const std::string &name, T def_value)
General Explicit Runge-Kutta Butcher Tableau.
virtual void setTableaus(std::string stepperType="", Teuchos::RCP< const RKButcherTableau< Scalar > > explicitTableau=Teuchos::null, Teuchos::RCP< const RKButcherTableau< Scalar > > implicitTableau=Teuchos::null)
Set both the explicit and implicit tableau from ParameterList.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void setModelPair(const Teuchos::RCP< WrapperModelEvaluatorPairPartIMEX_Basic< Scalar > > &modelPair)
Create WrapperModelPairIMEX from user-supplied ModelEvaluator pair.
ModelEvaluator pair for implicit and explicit (IMEX) evaluations.
Partitioned Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
void validExplicitODE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate that the model supports explicit ODE evaluation, f(x,t) [=xdot].
virtual void initialize()
Initialize after construction and changing input parameters.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
void evalExplicitModel(const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &X, Scalar time, Scalar stepSize, Scalar stageNumber, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &F) const
Thyra Base interface for time steppers.
Diagonally Implicit Runge-Kutta (DIRK) time stepper.
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 Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Provide a StepperState to the SolutionState. This Stepper does not have any special state data...
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Application Action for StepperRKBase.
bool isSublist(const std::string &name) const
void evalImplicitModelExplicitly(const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &X, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &Y, Scalar time, Scalar stepSize, Scalar stageNumber, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &G) const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
virtual void setExplicitTableau(Teuchos::RCP< const RKButcherTableau< Scalar > > explicitTableau)
Set the explicit tableau from tableau.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
virtual void setImplicitTableau(Teuchos::RCP< const RKButcherTableau< Scalar > > implicitTableau)
Set the implicit tableau from tableau.
Time-derivative interface for Partitioned IMEX RK.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
Set the model.
Teuchos::RCP< StepperIMEX_RK_Partition< Scalar > > createStepperIMEX_RK_Partition(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
virtual void setTableausPartition(Teuchos::RCP< Teuchos::ParameterList > pl, std::string stepperType)
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
void validImplicitODE_DAE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate ME supports implicit ODE/DAE evaluation, f(xdot,x,t) [= 0].
virtual void initialize()
Initialize during construction and after changing input parameters.
Solve for x and determine xDot from x.