10 #ifndef Tempus_StepperIMEX_RK_impl_hpp
11 #define Tempus_StepperIMEX_RK_impl_hpp
13 #include "Thyra_VectorStdOps.hpp"
15 #include "Tempus_StepperFactory.hpp"
20 template <
class Scalar>
24 stepperType !=
"IMEX RK 1st order" && stepperType !=
"SSP1_111" &&
25 stepperType !=
"IMEX RK SSP2" && stepperType !=
"IMEX RK SSP3" &&
26 stepperType !=
"SSP3_332" && stepperType !=
"SSP2_222" &&
27 stepperType !=
"SSP2_222_L" && stepperType !=
"SSP2_222_A" &&
28 stepperType !=
"IMEX RK ARS 233" && stepperType !=
"ARS 233" &&
29 stepperType !=
"General IMEX RK",
34 <<
" does not match one of the types for this Stepper:\n"
35 <<
" 'IMEX RK 1st order'\n"
37 <<
" 'IMEX RK SSP2'\n"
38 <<
" 'IMEX RK SSP3'\n"
43 <<
" 'IMEX RK ARS 233'\n"
45 <<
" 'General IMEX RK'\n");
47 this->setStepperName(stepperType);
48 this->setStepperType(stepperType);
49 this->setUseFSAL(
false);
50 this->setICConsistency(
"None");
51 this->setICConsistencyCheck(
false);
52 this->setZeroInitialGuess(
false);
54 this->setStageNumber(-1);
56 this->setTableaus(stepperType);
57 this->setAppAction(Teuchos::null);
58 this->setDefaultSolver();
61 template <
class Scalar>
65 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
66 bool zeroInitialGuess,
68 std::string stepperType,
73 stepperType !=
"IMEX RK 1st order" && stepperType !=
"SSP1_111" &&
74 stepperType !=
"IMEX RK SSP2" && stepperType !=
"IMEX RK SSP3" &&
75 stepperType !=
"SSP3_332" && stepperType !=
"SSP2_222" &&
76 stepperType !=
"SSP2_222_L" && stepperType !=
"SSP2_222_A" &&
77 stepperType !=
"IMEX RK ARS 233" && stepperType !=
"ARS 233" &&
78 stepperType !=
"General IMEX RK",
83 <<
" does not match one of the types for this Stepper:\n"
84 <<
" 'IMEX RK 1st order'\n"
86 <<
" 'IMEX RK SSP2'\n"
87 <<
" 'IMEX RK SSP3'\n"
92 <<
" 'IMEX RK ARS 233'\n"
94 <<
" 'General IMEX RK'\n");
96 this->setStepperName(stepperType);
97 this->setStepperType(stepperType);
98 this->setUseFSAL(useFSAL);
99 this->setICConsistency(ICConsistency);
100 this->setICConsistencyCheck(ICConsistencyCheck);
101 this->setZeroInitialGuess(zeroInitialGuess);
103 this->setStageNumber(-1);
105 if (stepperType ==
"General IMEX RK") {
106 this->setExplicitTableau(explicitTableau);
107 this->setImplicitTableau(implicitTableau);
110 this->setTableaus(stepperType);
112 this->setOrder(order);
113 this->setAppAction(stepperRKAppAction);
114 this->setSolver(solver);
116 if (appModel != Teuchos::null) {
117 this->setModel(appModel);
122 template <
class Scalar>
124 std::string stepperType,
128 if (stepperType ==
"") stepperType =
"IMEX RK SSP2";
130 if (stepperType ==
"IMEX RK 1st order") {
138 const Scalar one = ST::one();
139 const Scalar zero = ST::zero();
159 A, b, c, order, order, order));
160 expTableau->setTVD(
true);
161 expTableau->setTVDCoeff(2.0);
163 this->setExplicitTableau(expTableau);
169 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
173 const Scalar one = ST::one();
174 const Scalar zero = ST::zero();
194 A, b, c, order, order, order));
195 impTableau->setTVD(
true);
196 impTableau->setTVDCoeff(sspcoef);
198 this->setImplicitTableau(impTableau);
200 this->setStepperName(
"IMEX RK 1st order");
201 this->setStepperType(
"IMEX RK 1st order");
204 else if (stepperType ==
"SSP1_111") {
208 const int NumStages = 1;
213 const Scalar one = ST::one();
214 const Scalar zero = ST::zero();
226 "Explicit Tableau - SSP1_111", A, b, c, order, order, order));
227 expTableau->setTVD(
true);
228 expTableau->setTVDCoeff(1.0);
230 this->setExplicitTableau(expTableau);
235 const int NumStages = 1;
237 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
241 const Scalar one = ST::one();
253 "Implicit Tableau - SSP1_111", A, b, c, order, order, order));
254 impTableau->setTVD(
true);
255 impTableau->setTVDCoeff(sspcoef);
257 this->setImplicitTableau(impTableau);
259 this->setStepperName(
"SSP1_111");
260 this->setStepperType(
"SSP1_111");
263 else if (stepperType ==
"IMEX RK SSP2" || stepperType ==
"SSP2_222_L") {
266 this->setExplicitTableau(stepperERK->getTableau());
270 stepperSDIRK->setGammaType(
"2nd Order L-stable");
271 this->setImplicitTableau(stepperSDIRK->getTableau());
273 this->setStepperName(
"IMEX RK SSP2");
274 this->setStepperType(
"IMEX RK SSP2");
277 else if (stepperType ==
"SSP2_222" || stepperType ==
"SSP2_222_A") {
280 this->setExplicitTableau(stepperERK->getTableau());
284 stepperSDIRK->setGammaType(
"gamma");
285 stepperSDIRK->setGamma(0.5);
286 this->setImplicitTableau(stepperSDIRK->getTableau());
288 this->setStepperName(
"SSP2_222");
289 this->setStepperType(
"SSP2_222");
292 else if (stepperType ==
"IMEX RK SSP3" || stepperType ==
"SSP3_332") {
295 this->setExplicitTableau(stepperERK->getTableau());
299 this->setImplicitTableau(stepperSDIRK->getTableau());
301 this->setStepperName(
"IMEX RK SSP3");
302 this->setStepperType(
"IMEX RK SSP3");
305 else if (stepperType ==
"IMEX RK ARS 233" || stepperType ==
"ARS 233") {
311 const Scalar one = ST::one();
312 const Scalar zero = ST::zero();
313 const Scalar onehalf = ST::one() / (2 * ST::one());
314 const Scalar gamma = (3 * one + ST::squareroot(3 * one)) / (6 * one);
324 A(2, 0) = (gamma - 1.0);
325 A(2, 1) = (2.0 - 2.0 * gamma);
341 "Partition IMEX-RK Explicit Stepper", A, b, c, order, order, order));
343 this->setExplicitTableau(expTableau);
355 A(2, 1) = (1.0 - 2.0 * gamma);
371 "Partition IMEX-RK Implicit Stepper", A, b, c, order, order, order));
373 this->setImplicitTableau(impTableau);
375 this->setStepperName(
"IMEX RK ARS 233");
376 this->setStepperType(
"IMEX RK ARS 233");
379 else if (stepperType ==
"General IMEX RK") {
380 if (explicitTableau == Teuchos::null) {
383 this->setExplicitTableau(stepperERK->getTableau());
386 this->setExplicitTableau(explicitTableau);
389 if (explicitTableau == Teuchos::null) {
393 stepperSDIRK->setGammaType(
"2nd Order L-stable");
394 this->setImplicitTableau(stepperSDIRK->getTableau());
397 this->setImplicitTableau(implicitTableau);
400 this->setStepperName(
"General IMEX RK");
401 this->setStepperType(
"General IMEX RK");
406 true, std::logic_error,
407 "Error - Not a valid StepperIMEX_RK type! Stepper Type = "
408 << stepperType <<
"\n"
409 <<
" Current valid types are: \n"
410 <<
" 'IMEX RK 1st order\n"
412 <<
" 'IMEX RK SSP2' ('SSP2_222_L')\n"
413 <<
" 'SSP2_222' ('SSP2_222_A')\n"
414 <<
" 'IMEX RK SSP3' ('SSP3_332')\n"
415 <<
" 'IMEX RK ARS 233' ('ARS 233')\n"
416 <<
" 'General IMEX RK'\n");
420 explicitTableau_ == Teuchos::null, std::runtime_error,
421 "Error - StepperIMEX_RK - Explicit tableau is null!");
423 implicitTableau_ == Teuchos::null, std::runtime_error,
424 "Error - StepperIMEX_RK - Implicit tableau is null!");
426 explicitTableau_->numStages() != implicitTableau_->numStages(),
428 "Error - StepperIMEX_RK - Number of stages do not match!\n"
429 <<
" Explicit tableau = " << explicitTableau_->description() <<
"\n"
430 <<
" number of stages = " << explicitTableau_->numStages() <<
"\n"
431 <<
" Implicit tableau = " << implicitTableau_->description() <<
"\n"
432 <<
" number of stages = " << implicitTableau_->numStages() <<
"\n");
434 this->isInitialized_ =
false;
437 template <
class Scalar>
442 if (stepperType ==
"") {
443 if (pl == Teuchos::null)
444 stepperType =
"IMEX RK SSP2";
446 stepperType = pl->
get<std::string>(
"Stepper Type",
"IMEX RK SSP2");
449 if (stepperType !=
"General IMEX RK") {
450 this->setTableaus(stepperType);
453 if (pl != Teuchos::null) {
456 if (pl->
isSublist(
"IMEX-RK Explicit Stepper")) {
457 RCP<Teuchos::ParameterList> explicitPL =
459 pl->
sublist(
"IMEX-RK Explicit Stepper")));
461 auto stepperTemp = sf->createStepper(explicitPL, Teuchos::null);
465 stepperERK == Teuchos::null, std::logic_error,
466 "Error - The explicit component of a general IMEX RK stepper was "
467 "not specified as an ExplicitRK stepper");
468 explicitTableau = stepperERK->getTableau();
471 if (pl->
isSublist(
"IMEX-RK Implicit Stepper")) {
472 RCP<Teuchos::ParameterList> implicitPL =
474 pl->
sublist(
"IMEX-RK Implicit Stepper")));
476 auto stepperTemp = sf->createStepper(implicitPL, Teuchos::null);
480 stepperDIRK == Teuchos::null, std::logic_error,
481 "Error - The implicit component of a general IMEX RK stepper was "
482 "not specified as an DIRK stepper");
483 implicitTableau = stepperDIRK->getTableau();
487 !(explicitTableau != Teuchos::null &&
488 implicitTableau != Teuchos::null),
490 "Error - A parameter list was used to setup a general IMEX RK "
491 "stepper, but did not "
492 "specify both an explicit and an implicit tableau!\n");
494 this->setTableaus(stepperType, explicitTableau, implicitTableau);
495 this->setOrder(pl->
get<
int>(
"overall order", 1));
500 template <
class Scalar>
505 explicitTableau->isImplicit() ==
true, std::logic_error,
506 "Error - Received an implicit Tableau for setExplicitTableau()!\n"
507 <<
" Tableau = " << explicitTableau->description() <<
"\n");
508 explicitTableau_ = explicitTableau;
510 this->isInitialized_ =
false;
513 template <
class Scalar>
518 implicitTableau->isDIRK() !=
true, std::logic_error,
519 "Error - Did not receive a DIRK Tableau for setImplicitTableau()!\n"
520 <<
" Tableau = " << implicitTableau->description() <<
"\n");
521 implicitTableau_ = implicitTableau;
523 this->isInitialized_ =
false;
526 template <
class Scalar>
531 using Teuchos::rcp_const_cast;
532 using Teuchos::rcp_dynamic_cast;
533 RCP<Thyra::ModelEvaluator<Scalar> > ncModel =
535 RCP<WrapperModelEvaluatorPairIMEX_Basic<Scalar> > modelPairIMEX =
538 modelPairIMEX == Teuchos::null, std::logic_error,
539 "Error - StepperIMEX_RK::setModel() was given a ModelEvaluator that\n"
540 <<
" could not be cast to a WrapperModelEvaluatorPairIMEX_Basic!\n"
541 <<
" From: " << appModel <<
"\n"
542 <<
" To : " << modelPairIMEX <<
"\n"
543 <<
" Likely have given the wrong ModelEvaluator to this Stepper.\n");
545 setModelPair(modelPairIMEX);
547 TEUCHOS_TEST_FOR_EXCEPTION(this->solver_ == Teuchos::null, std::logic_error,
548 "Error - Solver is not set!\n");
549 this->solver_->setModel(modelPairIMEX);
551 this->isInitialized_ =
false;
559 template <
class Scalar>
566 this->wrapperModel_);
569 wrapperModelPairIMEX = modelPairIMEX;
570 wrapperModelPairIMEX->initialize();
571 int expXDim = wrapperModelPairIMEX->getExplicitModel()->get_x_space()->dim();
572 int impXDim = wrapperModelPairIMEX->getImplicitModel()->get_x_space()->dim();
574 expXDim != impXDim, std::logic_error,
576 <<
" Explicit and Implicit x vectors are incompatible!\n"
577 <<
" Explicit vector dim = " << expXDim <<
"\n"
578 <<
" Implicit vector dim = " << impXDim <<
"\n");
580 this->wrapperModel_ = wrapperModelPairIMEX;
582 this->isInitialized_ =
false;
590 template <
class Scalar>
597 this->wrapperModel_ =
599 explicitModel, implicitModel));
601 this->isInitialized_ =
false;
604 template <
class Scalar>
608 this->wrapperModel_ == Teuchos::null, std::logic_error,
609 "Error - Need to set the model, setModel(), before calling "
610 "StepperIMEX_RK::initialize()\n");
613 const int numStages = explicitTableau_->numStages();
614 stageF_.resize(numStages);
615 stageG_.resize(numStages);
616 for (
int i = 0; i < numStages; i++) {
617 stageF_[i] = Thyra::createMember(this->wrapperModel_->get_f_space());
618 stageG_[i] = Thyra::createMember(this->wrapperModel_->get_f_space());
623 xTilde_ = Thyra::createMember(this->wrapperModel_->get_x_space());
629 template <
class Scalar>
635 int numStates = solutionHistory->getNumStates();
638 numStates < 1, std::logic_error,
639 "Error - setInitialConditions() needs at least one SolutionState\n"
640 " to set the initial condition. Number of States = "
644 RCP<Teuchos::FancyOStream> out = this->getOStream();
645 Teuchos::OSTab ostab(out, 1,
"StepperIMEX_RK::setInitialConditions()");
646 *out <<
"Warning -- SolutionHistory has more than one state!\n"
647 <<
"Setting the initial conditions on the currentState.\n"
651 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
652 RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
655 auto inArgs = this->wrapperModel_->getNominalValues();
656 if (x == Teuchos::null) {
658 (x == Teuchos::null) && (inArgs.get_x() == Teuchos::null),
660 "Error - setInitialConditions() needs the ICs from the "
661 <<
"SolutionHistory\n"
662 <<
" or getNominalValues()!\n");
665 initialState->setX(x);
669 std::string icConsistency = this->getICConsistency();
671 icConsistency !=
"None", std::logic_error,
672 "Error - setInitialConditions() requested a consistency of '"
674 <<
"'.\n But only 'None' is available for IMEX-RK!\n");
677 this->getUseFSAL(), std::logic_error,
678 "Error - The First-Same-As-Last (FSAL) principle is not "
679 <<
"available for IMEX-RK. Set useFSAL=false.\n");
682 template <
typename Scalar>
685 Scalar stepSize, Scalar stageNumber,
691 this->wrapperModel_);
692 MEB::InArgs<Scalar> inArgs = wrapperModelPairIMEX->createInArgs();
694 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
695 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
696 if (inArgs.supports(MEB::IN_ARG_stage_number))
697 inArgs.set_stage_number(stageNumber);
704 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
706 MEB::OutArgs<Scalar> outArgs = wrapperModelPairIMEX->createOutArgs();
709 wrapperModelPairIMEX->getImplicitModel()->evalModel(inArgs, outArgs);
710 Thyra::Vt_S(G.ptr(), -1.0);
713 template <
typename Scalar>
716 Scalar stepSize, Scalar stageNumber,
723 this->wrapperModel_);
724 MEB::InArgs<Scalar> inArgs =
725 wrapperModelPairIMEX->getExplicitModel()->createInArgs();
727 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
728 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
729 if (inArgs.supports(MEB::IN_ARG_stage_number))
730 inArgs.set_stage_number(stageNumber);
737 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
739 MEB::OutArgs<Scalar> outArgs =
740 wrapperModelPairIMEX->getExplicitModel()->createOutArgs();
743 wrapperModelPairIMEX->getExplicitModel()->evalModel(inArgs, outArgs);
744 Thyra::Vt_S(F.ptr(), -1.0);
747 template <
class Scalar>
751 this->checkInitialized();
757 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperIMEX_RK::takeStep()");
760 solutionHistory->getNumStates() < 2, std::logic_error,
761 "Error - StepperIMEX_RK<Scalar>::takeStep(...)\n"
762 <<
"Need at least two SolutionStates for IMEX_RK.\n"
763 <<
" Number of States = " << solutionHistory->getNumStates()
764 <<
"\nTry setting in \"Solution History\" "
765 <<
"\"Storage Type\" = \"Undo\"\n"
766 <<
" or \"Storage Type\" = \"Static\" and "
767 <<
"\"Storage Limit\" = \"2\"\n");
769 RCP<SolutionState<Scalar> > currentState =
770 solutionHistory->getCurrentState();
771 RCP<SolutionState<Scalar> > workingState =
772 solutionHistory->getWorkingState();
773 const Scalar dt = workingState->getTimeStep();
774 const Scalar time = currentState->getTime();
776 const int numStages = explicitTableau_->numStages();
777 const SerialDenseMatrix<int, Scalar>& AHat = explicitTableau_->A();
778 const SerialDenseVector<int, Scalar>& bHat = explicitTableau_->b();
779 const SerialDenseVector<int, Scalar>& cHat = explicitTableau_->c();
780 const SerialDenseMatrix<int, Scalar>& A = implicitTableau_->A();
781 const SerialDenseVector<int, Scalar>& b = implicitTableau_->b();
782 const SerialDenseVector<int, Scalar>& c = implicitTableau_->c();
785 Thyra::assign(workingState->getX().ptr(), *(currentState->getX()));
787 RCP<StepperIMEX_RK<Scalar> > thisStepper = Teuchos::rcpFromRef(*
this);
788 this->stepperRKAppAction_->execute(
789 solutionHistory, thisStepper,
793 for (
int i = 0; i < numStages; ++i) {
794 this->setStageNumber(i);
795 Thyra::assign(xTilde_.ptr(), *(currentState->getX()));
796 for (
int j = 0; j < i; ++j) {
798 Thyra::Vp_StV(xTilde_.ptr(), -dt * AHat(i, j), *(stageF_[j]));
800 Thyra::Vp_StV(xTilde_.ptr(), -dt * A(i, j), *(stageG_[j]));
803 this->stepperRKAppAction_->execute(
804 solutionHistory, thisStepper,
807 Scalar ts = time + c(i) * dt;
808 Scalar tHats = time + cHat(i) * dt;
811 bool isNeeded =
false;
812 for (
int k = i + 1; k < numStages; ++k)
813 if (A(k, i) != 0.0) isNeeded =
true;
814 if (b(i) != 0.0) isNeeded =
true;
815 if (isNeeded ==
false) {
820 Thyra::assign(workingState->getX().ptr(), *xTilde_);
821 evalImplicitModelExplicitly(workingState->getX(), ts, dt, i,
827 const Scalar alpha = Scalar(1.0) / (dt * A(i, i));
828 const Scalar beta = Scalar(1.0);
833 alpha, xTilde_.getConst()));
838 this->stepperRKAppAction_->execute(
839 solutionHistory, thisStepper,
843 this->solveImplicitODE(workingState->getX(), stageG_[i], ts, p);
847 this->stepperRKAppAction_->execute(
848 solutionHistory, thisStepper,
852 Thyra::V_StVpStV(stageG_[i].ptr(), -alpha, *workingState->getX(), alpha,
856 this->stepperRKAppAction_->execute(
857 solutionHistory, thisStepper,
859 evalExplicitModel(workingState->getX(), tHats, dt, i, stageF_[i]);
860 this->stepperRKAppAction_->execute(
861 solutionHistory, thisStepper,
866 this->setStageNumber(-1);
869 Thyra::assign((workingState->getX()).ptr(), *(currentState->getX()));
870 for (
int i = 0; i < numStages; ++i) {
872 Thyra::Vp_StV((workingState->getX()).ptr(), -dt * bHat(i),
875 Thyra::Vp_StV((workingState->getX()).ptr(), -dt * b(i), *(stageG_[i]));
882 workingState->setOrder(this->getOrder());
883 workingState->computeNorms(currentState);
884 this->stepperRKAppAction_->execute(
885 solutionHistory, thisStepper,
897 template <
class Scalar>
906 template <
class Scalar>
916 out <<
"--- StepperIMEX_RK_Partition ---\n";
917 out <<
" explicitTableau_ = " << explicitTableau_ << std::endl;
919 explicitTableau_->describe(out, verbLevel);
920 out <<
" implicitTableau_ = " << implicitTableau_ << std::endl;
922 implicitTableau_->describe(out, verbLevel);
923 out <<
" xTilde_ = " << xTilde_ << std::endl;
924 out <<
" stageF_.size() = " << stageF_.size() << std::endl;
925 int numStages = stageF_.size();
926 for (
int i = 0; i < numStages; ++i)
927 out <<
" stageF_[" << i <<
"] = " << stageF_[i] << std::endl;
928 out <<
" stageG_.size() = " << stageG_.size() << std::endl;
929 numStages = stageG_.size();
930 for (
int i = 0; i < numStages; ++i)
931 out <<
" stageG_[" << i <<
"] = " << stageG_[i] << std::endl;
932 out <<
" stepperRKAppAction_= " << this->stepperRKAppAction_ << std::endl;
933 out <<
" order_ = " << order_ << std::endl;
934 out <<
"--------------------------------" << std::endl;
937 template <
class Scalar>
941 bool isValidSetup =
true;
947 this->wrapperModel_);
949 if (wrapperModelPairIMEX->getExplicitModel() == Teuchos::null) {
950 isValidSetup =
false;
951 out <<
"The explicit ModelEvaluator is not set!\n";
954 if (wrapperModelPairIMEX->getImplicitModel() == Teuchos::null) {
955 isValidSetup =
false;
956 out <<
"The implicit ModelEvaluator is not set!\n";
959 if (this->wrapperModel_ == Teuchos::null) {
960 isValidSetup =
false;
961 out <<
"The wrapper ModelEvaluator is not set!\n";
964 if (this->stepperRKAppAction_ == Teuchos::null) {
965 isValidSetup =
false;
966 out <<
"The AppAction is not set!\n";
969 if (explicitTableau_ == Teuchos::null) {
970 isValidSetup =
false;
971 out <<
"The explicit tableau is not set!\n";
974 if (implicitTableau_ == Teuchos::null) {
975 isValidSetup =
false;
976 out <<
"The implicit tableau is not set!\n";
982 template <
class Scalar>
986 auto pl = this->getValidParametersBasicImplicit();
987 pl->template set<int>(
"overall order", this->getOrder());
990 explicitStepper->setTableau(
991 explicitTableau_->A(), explicitTableau_->b(), explicitTableau_->c(),
992 explicitTableau_->order(), explicitTableau_->orderMin(),
993 explicitTableau_->orderMax(), explicitTableau_->bstar());
994 pl->set(
"IMEX-RK Explicit Stepper", *explicitStepper->getValidParameters());
997 implicitStepper->setTableau(
998 implicitTableau_->A(), implicitTableau_->b(), implicitTableau_->c(),
999 implicitTableau_->order(), implicitTableau_->orderMin(),
1000 implicitTableau_->orderMax(), implicitTableau_->bstar());
1001 pl->set(
"IMEX-RK Implicit Stepper", *implicitStepper->getValidParameters());
1008 template <
class Scalar>
1014 stepper->setStepperImplicitValues(pl);
1015 stepper->setTableaus(pl, stepperType);
1017 if (model != Teuchos::null) {
1018 stepper->setModel(model);
1019 stepper->initialize();
1026 #endif // Tempus_StepperIMEX_RK_impl_hpp
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void setImplicitTableau(Teuchos::RCP< const RKButcherTableau< Scalar > > implicitTableau)
Set the implicit tableau from tableau.
Explicit Runge-Kutta time stepper.
T & get(const std::string &name, T def_value)
General Explicit Runge-Kutta Butcher Tableau.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Implicit-Explicit Runge-Kutta (IMEX-RK) time stepper.
virtual void setExplicitTableau(Teuchos::RCP< const RKButcherTableau< Scalar > > explicitTableau)
Set the explicit tableau from tableau.
ModelEvaluator pair for implicit and explicit (IMEX) evaluations.
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
StepperIMEX_RK(std::string stepperType="IMEX RK SSP2")
Default constructor.
Thyra Base interface for time steppers.
virtual void setModelPair(const Teuchos::RCP< WrapperModelEvaluatorPairIMEX_Basic< Scalar > > &mePair)
Create WrapperModelPairIMEX from user-supplied ModelEvaluator pair.
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 void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Application Action for StepperRKBase.
bool isSublist(const std::string &name) const
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
virtual void initialize()
Initialize during construction and after changing input parameters.
void evalExplicitModel(const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &X, Scalar time, Scalar stepSize, Scalar stageNumber, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &F) const
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.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
basic_FancyOStream & setOutputToRootOnly(const int rootRank)
RK Explicit 3 Stage 3rd order TVD.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
void evalImplicitModelExplicitly(const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &X, Scalar time, Scalar stepSize, Scalar stageNumber, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &G) const
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Provide a StepperState to the SolutionState. This Stepper does not have any special state data...
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
Time-derivative interface for IMEX RK.
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
Set the model.
Teuchos::RCP< StepperIMEX_RK< Scalar > > createStepperIMEX_RK(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, std::string stepperType, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
void validImplicitODE_DAE(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Validate ME supports implicit ODE/DAE evaluation, f(xdot,x,t) [= 0].
Solve for x and determine xDot from x.