10 #ifndef Tempus_StepperIMEX_RK_Partition_impl_hpp
11 #define Tempus_StepperIMEX_RK_Partition_impl_hpp
13 #include "Thyra_VectorStdOps.hpp"
15 #include "Tempus_StepperFactory.hpp"
20 template <
class Scalar>
22 std::string stepperType)
25 stepperType !=
"Partitioned IMEX RK 1st order" &&
26 stepperType !=
"Partitioned IMEX RK SSP2" &&
27 stepperType !=
"Partitioned IMEX RK ARS 233" &&
28 stepperType !=
"General Partitioned IMEX RK",
33 <<
" does not match one of the types for this Stepper:\n"
34 <<
" 'Partitioned IMEX RK 1st order'\n"
35 <<
" 'Partitioned IMEX RK SSP2'\n"
36 <<
" 'Partitioned IMEX RK ARS 233'\n"
37 <<
" 'General Partitioned IMEX RK'\n");
39 this->setStepperName(
"Partitioned IMEX RK SSP2");
40 this->setStepperType(
"Partitioned IMEX RK SSP2");
41 this->setUseFSAL(
false);
42 this->setICConsistency(
"None");
43 this->setICConsistencyCheck(
false);
44 this->setZeroInitialGuess(
false);
46 this->setStageNumber(-1);
48 this->setTableaus(stepperType);
49 this->setAppAction(Teuchos::null);
50 this->setDefaultSolver();
53 template <
class Scalar>
57 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
58 bool zeroInitialGuess,
60 std::string stepperType,
65 stepperType !=
"Partitioned IMEX RK 1st order" &&
66 stepperType !=
"Partitioned IMEX RK SSP2" &&
67 stepperType !=
"Partitioned IMEX RK ARS 233" &&
68 stepperType !=
"General Partitioned IMEX RK",
73 <<
" does not match one of the types for this Stepper:\n"
74 <<
" 'Partitioned IMEX RK 1st order'\n"
75 <<
" 'Partitioned IMEX RK SSP2'\n"
76 <<
" 'Partitioned IMEX RK ARS 233'\n"
77 <<
" 'General Partitioned IMEX RK'\n");
79 this->setStepperName(stepperType);
80 this->setStepperType(stepperType);
81 this->setUseFSAL(useFSAL);
82 this->setICConsistency(ICConsistency);
83 this->setICConsistencyCheck(ICConsistencyCheck);
84 this->setZeroInitialGuess(zeroInitialGuess);
85 this->setOrder(order);
87 this->setStageNumber(-1);
89 if (stepperType ==
"General Partitioned IMEX RK") {
90 this->setExplicitTableau(explicitTableau);
91 this->setImplicitTableau(implicitTableau);
94 this->setTableaus(stepperType);
96 this->setAppAction(stepperRKAppAction);
97 this->setSolver(solver);
99 if (appModel != Teuchos::null) {
100 this->setModel(appModel);
105 template <
class Scalar>
107 std::string stepperType,
111 if (stepperType ==
"") stepperType =
"Partitioned IMEX RK SSP2";
113 if (stepperType ==
"Partitioned IMEX RK 1st order") {
121 const Scalar one = ST::one();
122 const Scalar zero = ST::zero();
141 "Explicit Tableau - Partitioned IMEX RK 1st order", A, b, c, order,
143 expTableau->setTVD(
true);
144 expTableau->setTVDCoeff(2.0);
146 this->setExplicitTableau(expTableau);
152 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
156 const Scalar one = ST::one();
157 const Scalar zero = ST::zero();
176 "Implicit Tableau - Partitioned IMEX RK 1st order", A, b, c, order,
178 impTableau->setTVD(
true);
179 impTableau->setTVDCoeff(sspcoef);
181 this->setImplicitTableau(impTableau);
183 this->setStepperName(
"Partitioned IMEX RK 1st order");
184 this->setStepperType(
"Partitioned IMEX RK 1st order");
187 else if (stepperType ==
"Partitioned IMEX RK SSP2") {
190 this->setExplicitTableau(stepperERK->getTableau());
194 stepperSDIRK->setGammaType(
"2nd Order L-stable");
195 this->setImplicitTableau(stepperSDIRK->getTableau());
197 this->setStepperName(
"Partitioned IMEX RK SSP2");
198 this->setStepperType(
"Partitioned IMEX RK SSP2");
201 else if (stepperType ==
"Partitioned IMEX RK ARS 233") {
207 const Scalar one = ST::one();
208 const Scalar zero = ST::zero();
209 const Scalar onehalf = ST::one() / (2 * ST::one());
210 const Scalar gamma = (3 * one + ST::squareroot(3 * one)) / (6 * one);
220 A(2, 0) = (gamma - 1.0);
221 A(2, 1) = (2.0 - 2.0 * gamma);
237 "Explicit Tableau - Partitioned IMEX RK ARS 233", A, b, c, order,
240 this->setExplicitTableau(expTableau);
252 A(2, 1) = (1.0 - 2.0 * gamma);
268 "Implicit Tableau - Partitioned IMEX RK ARS 233", A, b, c, order,
271 this->setImplicitTableau(impTableau);
273 this->setStepperName(
"Partitioned IMEX RK ARS 233");
274 this->setStepperType(
"Partitioned IMEX RK ARS 233");
277 else if (stepperType ==
"General Partitioned IMEX RK") {
278 if (explicitTableau == Teuchos::null) {
281 this->setExplicitTableau(stepperERK->getTableau());
284 this->setExplicitTableau(explicitTableau);
287 if (implicitTableau == Teuchos::null) {
291 stepperSDIRK->setGammaType(
"2nd Order L-stable");
292 this->setImplicitTableau(stepperSDIRK->getTableau());
295 this->setImplicitTableau(implicitTableau);
298 this->setStepperName(
"General Partitioned IMEX RK");
299 this->setStepperType(
"General Partitioned IMEX RK");
304 true, std::logic_error,
305 "Error - Not a valid StepperIMEX_RK_Partition type! Stepper Type = "
306 << stepperType <<
"\n"
307 <<
" Current valid types are: \n"
308 <<
" 'Partitioned IMEX RK 1st order'\n"
309 <<
" 'Partitioned IMEX RK SSP2'\n"
310 <<
" 'Partitioned IMEX RK ARS 233'\n"
311 <<
" 'General Partitioned IMEX RK'\n");
315 explicitTableau_ == Teuchos::null, std::runtime_error,
316 "Error - StepperIMEX_RK_Partition - Explicit tableau is null!");
318 implicitTableau_ == Teuchos::null, std::runtime_error,
319 "Error - StepperIMEX_RK_Partition - Implicit tableau is null!");
321 explicitTableau_->numStages() != implicitTableau_->numStages(),
323 "Error - StepperIMEX_RK_Partition - Number of stages do not match!\n"
324 <<
" Explicit tableau = " << explicitTableau_->description() <<
"\n"
325 <<
" number of stages = " << explicitTableau_->numStages() <<
"\n"
326 <<
" Implicit tableau = " << implicitTableau_->description() <<
"\n"
327 <<
" number of stages = " << implicitTableau_->numStages()
330 this->isInitialized_ =
false;
333 template <
class Scalar>
338 if (stepperType ==
"") {
339 if (pl == Teuchos::null)
340 stepperType =
"Partitioned IMEX RK SSP2";
343 pl->
get<std::string>(
"Stepper Type",
"Partitioned IMEX RK SSP2");
346 if (stepperType !=
"General Partitioned IMEX RK") {
347 this->setTableaus(stepperType);
350 if (pl != Teuchos::null) {
353 if (pl->
isSublist(
"IMEX-RK Explicit Stepper")) {
354 RCP<Teuchos::ParameterList> explicitPL =
356 pl->
sublist(
"IMEX-RK Explicit Stepper")));
358 auto stepperTemp = sf->createStepper(explicitPL, Teuchos::null);
362 stepperERK == Teuchos::null, std::logic_error,
363 "Error - The explicit component of a general partitioned IMEX RK "
364 "stepper was not specified as an ExplicitRK stepper");
365 explicitTableau = stepperERK->getTableau();
368 if (pl->
isSublist(
"IMEX-RK Implicit Stepper")) {
369 RCP<Teuchos::ParameterList> implicitPL =
371 pl->
sublist(
"IMEX-RK Implicit Stepper")));
373 auto stepperTemp = sf->createStepper(implicitPL, Teuchos::null);
377 stepperDIRK == Teuchos::null, std::logic_error,
378 "Error - The implicit component of a general partitioned IMEX RK "
379 "stepper was not specified as an DIRK stepper");
380 implicitTableau = stepperDIRK->getTableau();
384 !(explicitTableau != Teuchos::null &&
385 implicitTableau != Teuchos::null),
387 "Error - A parameter list was used to setup a general partitioned "
388 "IMEX RK stepper, but did not "
389 "specify both an explicit and an implicit tableau!\n");
391 this->setTableaus(stepperType, explicitTableau, implicitTableau);
393 this->setOrder(pl->
get<
int>(
"overall order", 1));
398 template <
class Scalar>
403 explicitTableau->isImplicit() ==
true, std::logic_error,
404 "Error - Received an implicit Tableau for setExplicitTableau()!\n"
405 <<
" Tableau = " << explicitTableau->description() <<
"\n");
406 explicitTableau_ = explicitTableau;
408 this->isInitialized_ =
false;
411 template <
class Scalar>
416 implicitTableau->isDIRK() !=
true, std::logic_error,
417 "Error - Did not receive a DIRK Tableau for setImplicitTableau()!\n"
418 <<
" Tableau = " << implicitTableau->description() <<
"\n");
419 implicitTableau_ = implicitTableau;
421 this->isInitialized_ =
false;
424 template <
class Scalar>
429 using Teuchos::rcp_const_cast;
430 using Teuchos::rcp_dynamic_cast;
431 RCP<Thyra::ModelEvaluator<Scalar> > ncModel =
433 RCP<WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> > modelPairIMEX =
437 modelPairIMEX == Teuchos::null, std::logic_error,
438 "Error - StepperIMEX_RK::setModel() was given a ModelEvaluator that\n"
439 <<
" could not be cast to a WrapperModelEvaluatorPairPartIMEX_Basic!\n"
440 <<
" From: " << appModel <<
"\n To : " << modelPairIMEX
441 <<
"\n Likely have given the wrong ModelEvaluator to this Stepper.\n");
443 setModelPair(modelPairIMEX);
445 this->isInitialized_ =
false;
453 template <
class Scalar>
459 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
461 this->wrapperModel_);
464 wrapperModelPairPartIMEX = mePairIMEX;
465 wrapperModelPairPartIMEX->initialize();
467 this->wrapperModel_ = wrapperModelPairPartIMEX;
469 this->isInitialized_ =
false;
477 template <
class Scalar>
484 this->wrapperModel_ =
486 explicitModel, implicitModel));
488 this->isInitialized_ =
false;
491 template <
class Scalar>
495 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
497 this->wrapperModel_);
499 wrapperModelPairPartIMEX == Teuchos::null, std::logic_error,
500 "Error - Can not cast the wrapper Model Evaluator to a IMEX Model Pair."
501 "StepperIMEX_RK_Partition::initialize()\n");
504 const int numStages = explicitTableau_->numStages();
505 stageF_.resize(numStages);
506 stageGx_.resize(numStages);
507 for (
int i = 0; i < numStages; i++) {
508 stageF_[i] = Thyra::createMember(
509 wrapperModelPairPartIMEX->getExplicitModel()->get_f_space());
510 stageGx_[i] = Thyra::createMember(
511 wrapperModelPairPartIMEX->getImplicitModel()->get_f_space());
516 xTilde_ = Thyra::createMember(
517 wrapperModelPairPartIMEX->getImplicitModel()->get_x_space());
523 template <
class Scalar>
529 int numStates = solutionHistory->getNumStates();
532 numStates < 1, std::logic_error,
533 "Error - setInitialConditions() needs at least one SolutionState\n"
534 " to set the initial condition. Number of States = "
538 RCP<Teuchos::FancyOStream> out = this->getOStream();
539 Teuchos::OSTab ostab(out, 1,
"StepperIMEX_RK::setInitialConditions()");
540 *out <<
"Warning -- SolutionHistory has more than one state!\n"
541 <<
"Setting the initial conditions on the currentState.\n"
545 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
546 RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
549 auto inArgs = this->wrapperModel_->getNominalValues();
550 if (x == Teuchos::null) {
552 (x == Teuchos::null) && (inArgs.get_x() == Teuchos::null),
554 "Error - setInitialConditions() needs the ICs from the "
555 "SolutionHistory\n or getNominalValues()!\n");
558 initialState->setX(x);
562 std::string icConsistency = this->getICConsistency();
564 icConsistency !=
"None", std::logic_error,
565 "Error - setInitialConditions() requested a consistency of '"
567 <<
"'.\n But only 'None' is available for IMEX-RK!\n");
570 this->getUseFSAL(), std::logic_error,
571 "Error - The First-Same-As-Last (FSAL) principle is not "
572 <<
"available for IMEX-RK. Set useFSAL=false.\n");
575 template <
typename Scalar>
579 Scalar stepSize, Scalar stageNumber,
584 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
586 this->wrapperModel_);
587 MEB::InArgs<Scalar> inArgs = wrapperModelPairPartIMEX->getInArgs();
589 inArgs.set_p(wrapperModelPairPartIMEX->getParameterIndex(), Y);
590 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
591 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
592 if (inArgs.supports(MEB::IN_ARG_stage_number))
593 inArgs.set_stage_number(stageNumber);
600 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
602 MEB::OutArgs<Scalar> outArgs = wrapperModelPairPartIMEX->getOutArgs();
605 wrapperModelPairPartIMEX->getImplicitModel()->evalModel(inArgs, outArgs);
606 Thyra::Vt_S(G.ptr(), -1.0);
609 template <
typename Scalar>
612 Scalar stepSize, Scalar stageNumber,
618 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
620 this->wrapperModel_);
621 MEB::InArgs<Scalar> inArgs =
622 wrapperModelPairPartIMEX->getExplicitModel()->createInArgs();
624 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
625 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
626 if (inArgs.supports(MEB::IN_ARG_stage_number))
627 inArgs.set_stage_number(stageNumber);
634 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
636 MEB::OutArgs<Scalar> outArgs =
637 wrapperModelPairPartIMEX->getExplicitModel()->createOutArgs();
640 wrapperModelPairPartIMEX->getExplicitModel()->evalModel(inArgs, outArgs);
641 Thyra::Vt_S(F.ptr(), -1.0);
644 template <
class Scalar>
648 this->checkInitialized();
654 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperIMEX_RK_Partition::takeStep()");
657 solutionHistory->getNumStates() < 2, std::logic_error,
658 "Error - StepperIMEX_RK_Partition<Scalar>::takeStep(...)\n"
659 <<
"Need at least two SolutionStates for IMEX_RK_Partition.\n"
660 <<
" Number of States = " << solutionHistory->getNumStates()
661 <<
"\nTry setting in \"Solution History\" \"Storage Type\" = "
662 <<
"\"Undo\"\n or \"Storage Type\" = \"Static\" and \"Storage Limit\" = "
665 RCP<SolutionState<Scalar> > currentState =
666 solutionHistory->getCurrentState();
667 RCP<SolutionState<Scalar> > workingState =
668 solutionHistory->getWorkingState();
669 const Scalar dt = workingState->getTimeStep();
670 const Scalar time = currentState->getTime();
672 const int numStages = explicitTableau_->numStages();
673 const SerialDenseMatrix<int, Scalar>& AHat = explicitTableau_->A();
674 const SerialDenseVector<int, Scalar>& bHat = explicitTableau_->b();
675 const SerialDenseVector<int, Scalar>& cHat = explicitTableau_->c();
676 const SerialDenseMatrix<int, Scalar>& A = implicitTableau_->A();
677 const SerialDenseVector<int, Scalar>& b = implicitTableau_->b();
678 const SerialDenseVector<int, Scalar>& c = implicitTableau_->c();
681 wrapperModelPairPartIMEX = Teuchos::rcp_dynamic_cast<
683 this->wrapperModel_);
686 Thyra::assign(workingState->getX().ptr(), *(currentState->getX()));
687 RCP<Thyra::VectorBase<Scalar> > stageY =
688 wrapperModelPairPartIMEX->getExplicitOnlyVector(workingState->getX());
689 RCP<Thyra::VectorBase<Scalar> > stageX =
690 wrapperModelPairPartIMEX->getIMEXVector(workingState->getX());
692 RCP<StepperIMEX_RK_Partition<Scalar> > thisStepper =
693 Teuchos::rcpFromRef(*
this);
694 this->stepperRKAppAction_->execute(
695 solutionHistory, thisStepper,
699 for (
int i = 0; i < numStages; ++i) {
700 this->setStageNumber(i);
702 Thyra::assign(stageY.ptr(),
703 *(wrapperModelPairPartIMEX->getExplicitOnlyVector(
704 currentState->getX())));
707 *(wrapperModelPairPartIMEX->getIMEXVector(currentState->getX())));
708 for (
int j = 0; j < i; ++j) {
710 RCP<Thyra::VectorBase<Scalar> > stageFy =
711 wrapperModelPairPartIMEX->getExplicitOnlyVector(stageF_[j]);
712 RCP<Thyra::VectorBase<Scalar> > stageFx =
713 wrapperModelPairPartIMEX->getIMEXVector(stageF_[j]);
714 Thyra::Vp_StV(stageY.ptr(), -dt * AHat(i, j), *stageFy);
715 Thyra::Vp_StV(xTilde_.ptr(), -dt * AHat(i, j), *stageFx);
718 Thyra::Vp_StV(xTilde_.ptr(), -dt * A(i, j), *(stageGx_[j]));
721 this->stepperRKAppAction_->execute(
722 solutionHistory, thisStepper,
725 Scalar ts = time + c(i) * dt;
726 Scalar tHats = time + cHat(i) * dt;
729 bool isNeeded =
false;
730 for (
int k = i + 1; k < numStages; ++k)
731 if (A(k, i) != 0.0) isNeeded =
true;
732 if (b(i) != 0.0) isNeeded =
true;
733 if (isNeeded ==
false) {
738 Thyra::assign(stageX.ptr(), *xTilde_);
739 evalImplicitModelExplicitly(stageX, stageY, ts, dt, i, stageGx_[i]);
744 const Scalar alpha = Scalar(1.0) / (dt * A(i, i));
745 const Scalar beta = Scalar(1.0);
748 RCP<TimeDerivative<Scalar> > timeDer =
750 alpha, xTilde_.getConst()));
755 this->stepperRKAppAction_->execute(
756 solutionHistory, thisStepper,
759 wrapperModelPairPartIMEX->setUseImplicitModel(
true);
760 this->solver_->setModel(wrapperModelPairPartIMEX);
763 if (wrapperModelPairPartIMEX->getParameterIndex() >= 0)
764 sStatus = this->solveImplicitODE(
765 stageX, stageGx_[i], ts, p, stageY,
766 wrapperModelPairPartIMEX->getParameterIndex());
768 sStatus = this->solveImplicitODE(stageX, stageGx_[i], ts, p);
772 wrapperModelPairPartIMEX->setUseImplicitModel(
false);
774 this->stepperRKAppAction_->execute(
775 solutionHistory, thisStepper,
779 Thyra::V_StVpStV(stageGx_[i].ptr(), -alpha, *stageX, alpha, *xTilde_);
782 this->stepperRKAppAction_->execute(
783 solutionHistory, thisStepper,
785 evalExplicitModel(workingState->getX(), tHats, dt, i, stageF_[i]);
786 this->stepperRKAppAction_->execute(
787 solutionHistory, thisStepper,
793 Thyra::assign((workingState->getX()).ptr(), *(currentState->getX()));
794 RCP<Thyra::VectorBase<Scalar> > Z = workingState->getX();
795 RCP<Thyra::VectorBase<Scalar> > X =
796 wrapperModelPairPartIMEX->getIMEXVector(Z);
797 for (
int i = 0; i < numStages; ++i) {
799 Thyra::Vp_StV(Z.ptr(), -dt * bHat(i), *(stageF_[i]));
801 Thyra::Vp_StV(X.ptr(), -dt * b(i), *(stageGx_[i]));
808 workingState->setOrder(this->getOrder());
809 workingState->computeNorms(currentState);
810 this->stepperRKAppAction_->execute(
811 solutionHistory, thisStepper,
815 this->setStageNumber(-1);
825 template <
class Scalar>
834 template <
class Scalar>
843 out <<
"--- StepperIMEX_RK_Partition ---\n";
844 out <<
" explicitTableau_ = " << explicitTableau_ << std::endl;
846 explicitTableau_->describe(out, verbLevel);
847 out <<
" implicitTableau_ = " << implicitTableau_ << std::endl;
849 implicitTableau_->describe(out, verbLevel);
850 out <<
" xTilde_ = " << xTilde_ << std::endl;
851 out <<
" stageF_.size() = " << stageF_.size() << std::endl;
852 int numStages = stageF_.size();
853 for (
int i = 0; i < numStages; ++i)
854 out <<
" stageF_[" << i <<
"] = " << stageF_[i] << std::endl;
855 out <<
" stageGx_.size() = " << stageGx_.size() << std::endl;
856 numStages = stageGx_.size();
857 for (
int i = 0; i < numStages; ++i)
858 out <<
" stageGx_[" << i <<
"] = " << stageGx_[i] << std::endl;
859 out <<
" stepperRKAppAction_= " << this->stepperRKAppAction_ << std::endl;
860 out <<
" order_ = " << order_ << std::endl;
861 out <<
"--------------------------------" << std::endl;
864 template <
class Scalar>
870 bool isValidSetup =
true;
876 this->wrapperModel_);
878 if (wrapperModelPairIMEX->getExplicitModel() == Teuchos::null) {
879 isValidSetup =
false;
880 out <<
"The explicit ModelEvaluator is not set!\n";
883 if (wrapperModelPairIMEX->getImplicitModel() == Teuchos::null) {
884 isValidSetup =
false;
885 out <<
"The implicit ModelEvaluator is not set!\n";
888 if (this->wrapperModel_ == Teuchos::null) {
889 isValidSetup =
false;
890 out <<
"The wrapper ModelEvaluator is not set!\n";
893 if (this->solver_ == Teuchos::null) {
894 isValidSetup =
false;
895 out <<
"The solver is not set!\n";
898 if (this->stepperRKAppAction_ == Teuchos::null) {
899 isValidSetup =
false;
900 out <<
"The AppAction is not set!\n";
903 if (explicitTableau_ == Teuchos::null) {
904 isValidSetup =
false;
905 out <<
"The explicit tableau is not set!\n";
908 if (implicitTableau_ == Teuchos::null) {
909 isValidSetup =
false;
910 out <<
"The implicit tableau is not set!\n";
916 template <
class Scalar>
920 auto pl = this->getValidParametersBasicImplicit();
921 pl->template set<int>(
"overall order", this->getOrder());
924 explicitStepper->setTableau(
925 explicitTableau_->A(), explicitTableau_->b(), explicitTableau_->c(),
926 explicitTableau_->order(), explicitTableau_->orderMin(),
927 explicitTableau_->orderMax(), explicitTableau_->bstar());
928 pl->set(
"IMEX-RK Explicit Stepper", *explicitStepper->getValidParameters());
931 implicitStepper->setTableau(
932 implicitTableau_->A(), implicitTableau_->b(), implicitTableau_->c(),
933 implicitTableau_->order(), implicitTableau_->orderMin(),
934 implicitTableau_->orderMax(), implicitTableau_->bstar());
935 pl->set(
"IMEX-RK Implicit Stepper", *implicitStepper->getValidParameters());
942 template <
class Scalar>
949 stepper->setStepperImplicitValues(pl);
950 stepper->setTableausPartition(pl, stepperType);
952 if (model != Teuchos::null) {
953 stepper->setModel(model);
954 stepper->initialize();
961 #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.