9 #ifndef Tempus_StepperIMEX_RK_impl_hpp
10 #define Tempus_StepperIMEX_RK_impl_hpp
12 #include "Thyra_VectorStdOps.hpp"
14 #include "Tempus_StepperFactory.hpp"
19 template <
class Scalar>
23 stepperType !=
"IMEX RK 1st order" && stepperType !=
"SSP1_111" &&
24 stepperType !=
"IMEX RK SSP2" && stepperType !=
"IMEX RK SSP3" &&
25 stepperType !=
"SSP3_332" && stepperType !=
"SSP2_222" &&
26 stepperType !=
"SSP2_222_L" && stepperType !=
"SSP2_222_A" &&
27 stepperType !=
"IMEX RK ARS 233" && stepperType !=
"ARS 233" &&
28 stepperType !=
"General IMEX RK",
33 <<
" does not match one of the types for this Stepper:\n"
34 <<
" 'IMEX RK 1st order'\n"
36 <<
" 'IMEX RK SSP2'\n"
37 <<
" 'IMEX RK SSP3'\n"
42 <<
" 'IMEX RK ARS 233'\n"
44 <<
" 'General IMEX RK'\n");
46 this->setStepperName(stepperType);
47 this->setStepperType(stepperType);
48 this->setUseFSAL(
false);
49 this->setICConsistency(
"None");
50 this->setICConsistencyCheck(
false);
51 this->setZeroInitialGuess(
false);
53 this->setStageNumber(-1);
55 this->setTableaus(stepperType);
56 this->setAppAction(Teuchos::null);
57 this->setDefaultSolver();
60 template <
class Scalar>
64 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
65 bool zeroInitialGuess,
67 std::string stepperType,
72 stepperType !=
"IMEX RK 1st order" && stepperType !=
"SSP1_111" &&
73 stepperType !=
"IMEX RK SSP2" && stepperType !=
"IMEX RK SSP3" &&
74 stepperType !=
"SSP3_332" && stepperType !=
"SSP2_222" &&
75 stepperType !=
"SSP2_222_L" && stepperType !=
"SSP2_222_A" &&
76 stepperType !=
"IMEX RK ARS 233" && stepperType !=
"ARS 233" &&
77 stepperType !=
"General IMEX RK",
82 <<
" does not match one of the types for this Stepper:\n"
83 <<
" 'IMEX RK 1st order'\n"
85 <<
" 'IMEX RK SSP2'\n"
86 <<
" 'IMEX RK SSP3'\n"
91 <<
" 'IMEX RK ARS 233'\n"
93 <<
" 'General IMEX RK'\n");
95 this->setStepperName(stepperType);
96 this->setStepperType(stepperType);
97 this->setUseFSAL(useFSAL);
98 this->setICConsistency(ICConsistency);
99 this->setICConsistencyCheck(ICConsistencyCheck);
100 this->setZeroInitialGuess(zeroInitialGuess);
102 this->setStageNumber(-1);
104 if (stepperType ==
"General IMEX RK") {
105 this->setExplicitTableau(explicitTableau);
106 this->setImplicitTableau(implicitTableau);
109 this->setTableaus(stepperType);
111 this->setOrder(order);
112 this->setAppAction(stepperRKAppAction);
113 this->setSolver(solver);
115 if (appModel != Teuchos::null) {
116 this->setModel(appModel);
121 template <
class Scalar>
123 std::string stepperType,
127 if (stepperType ==
"") stepperType =
"IMEX RK SSP2";
129 if (stepperType ==
"IMEX RK 1st order") {
137 const Scalar one = ST::one();
138 const Scalar zero = ST::zero();
158 A, b, c, order, order, order));
159 expTableau->setTVD(
true);
160 expTableau->setTVDCoeff(2.0);
162 this->setExplicitTableau(expTableau);
168 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
172 const Scalar one = ST::one();
173 const Scalar zero = ST::zero();
193 A, b, c, order, order, order));
194 impTableau->setTVD(
true);
195 impTableau->setTVDCoeff(sspcoef);
197 this->setImplicitTableau(impTableau);
199 this->setStepperName(
"IMEX RK 1st order");
200 this->setStepperType(
"IMEX RK 1st order");
203 else if (stepperType ==
"SSP1_111") {
207 const int NumStages = 1;
212 const Scalar one = ST::one();
213 const Scalar zero = ST::zero();
225 "Explicit Tableau - SSP1_111", A, b, c, order, order, order));
226 expTableau->setTVD(
true);
227 expTableau->setTVDCoeff(1.0);
229 this->setExplicitTableau(expTableau);
234 const int NumStages = 1;
236 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
240 const Scalar one = ST::one();
252 "Implicit Tableau - SSP1_111", A, b, c, order, order, order));
253 impTableau->setTVD(
true);
254 impTableau->setTVDCoeff(sspcoef);
256 this->setImplicitTableau(impTableau);
258 this->setStepperName(
"SSP1_111");
259 this->setStepperType(
"SSP1_111");
262 else if (stepperType ==
"IMEX RK SSP2" || stepperType ==
"SSP2_222_L") {
265 this->setExplicitTableau(stepperERK->getTableau());
269 stepperSDIRK->setGammaType(
"2nd Order L-stable");
270 this->setImplicitTableau(stepperSDIRK->getTableau());
272 this->setStepperName(
"IMEX RK SSP2");
273 this->setStepperType(
"IMEX RK SSP2");
276 else if (stepperType ==
"SSP2_222" || stepperType ==
"SSP2_222_A") {
279 this->setExplicitTableau(stepperERK->getTableau());
283 stepperSDIRK->setGammaType(
"gamma");
284 stepperSDIRK->setGamma(0.5);
285 this->setImplicitTableau(stepperSDIRK->getTableau());
287 this->setStepperName(
"SSP2_222");
288 this->setStepperType(
"SSP2_222");
291 else if (stepperType ==
"IMEX RK SSP3" || stepperType ==
"SSP3_332") {
294 this->setExplicitTableau(stepperERK->getTableau());
298 this->setImplicitTableau(stepperSDIRK->getTableau());
300 this->setStepperName(
"IMEX RK SSP3");
301 this->setStepperType(
"IMEX RK SSP3");
304 else if (stepperType ==
"IMEX RK ARS 233" || stepperType ==
"ARS 233") {
310 const Scalar one = ST::one();
311 const Scalar zero = ST::zero();
312 const Scalar onehalf = ST::one() / (2 * ST::one());
313 const Scalar gamma = (3 * one + ST::squareroot(3 * one)) / (6 * one);
323 A(2, 0) = (gamma - 1.0);
324 A(2, 1) = (2.0 - 2.0 * gamma);
340 "Partition IMEX-RK Explicit Stepper", A, b, c, order, order, order));
342 this->setExplicitTableau(expTableau);
354 A(2, 1) = (1.0 - 2.0 * gamma);
370 "Partition IMEX-RK Implicit Stepper", A, b, c, order, order, order));
372 this->setImplicitTableau(impTableau);
374 this->setStepperName(
"IMEX RK ARS 233");
375 this->setStepperType(
"IMEX RK ARS 233");
378 else if (stepperType ==
"General IMEX RK") {
379 if (explicitTableau == Teuchos::null) {
382 this->setExplicitTableau(stepperERK->getTableau());
385 this->setExplicitTableau(explicitTableau);
388 if (explicitTableau == Teuchos::null) {
392 stepperSDIRK->setGammaType(
"2nd Order L-stable");
393 this->setImplicitTableau(stepperSDIRK->getTableau());
396 this->setImplicitTableau(implicitTableau);
399 this->setStepperName(
"General IMEX RK");
400 this->setStepperType(
"General IMEX RK");
405 true, std::logic_error,
406 "Error - Not a valid StepperIMEX_RK type! Stepper Type = "
407 << stepperType <<
"\n"
408 <<
" Current valid types are: \n"
409 <<
" 'IMEX RK 1st order\n"
411 <<
" 'IMEX RK SSP2' ('SSP2_222_L')\n"
412 <<
" 'SSP2_222' ('SSP2_222_A')\n"
413 <<
" 'IMEX RK SSP3' ('SSP3_332')\n"
414 <<
" 'IMEX RK ARS 233' ('ARS 233')\n"
415 <<
" 'General IMEX RK'\n");
419 explicitTableau_ == Teuchos::null, std::runtime_error,
420 "Error - StepperIMEX_RK - Explicit tableau is null!");
422 implicitTableau_ == Teuchos::null, std::runtime_error,
423 "Error - StepperIMEX_RK - Implicit tableau is null!");
425 explicitTableau_->numStages() != implicitTableau_->numStages(),
427 "Error - StepperIMEX_RK - Number of stages do not match!\n"
428 <<
" Explicit tableau = " << explicitTableau_->description() <<
"\n"
429 <<
" number of stages = " << explicitTableau_->numStages() <<
"\n"
430 <<
" Implicit tableau = " << implicitTableau_->description() <<
"\n"
431 <<
" number of stages = " << implicitTableau_->numStages() <<
"\n");
433 this->isInitialized_ =
false;
436 template <
class Scalar>
441 if (stepperType ==
"") {
442 if (pl == Teuchos::null)
443 stepperType =
"IMEX RK SSP2";
445 stepperType = pl->
get<std::string>(
"Stepper Type",
"IMEX RK SSP2");
448 if (stepperType !=
"General IMEX RK") {
449 this->setTableaus(stepperType);
452 if (pl != Teuchos::null) {
455 if (pl->
isSublist(
"IMEX-RK Explicit Stepper")) {
456 RCP<Teuchos::ParameterList> explicitPL =
458 pl->
sublist(
"IMEX-RK Explicit Stepper")));
460 auto stepperTemp = sf->createStepper(explicitPL, Teuchos::null);
464 stepperERK == Teuchos::null, std::logic_error,
465 "Error - The explicit component of a general IMEX RK stepper was "
466 "not specified as an ExplicitRK stepper");
467 explicitTableau = stepperERK->getTableau();
470 if (pl->
isSublist(
"IMEX-RK Implicit Stepper")) {
471 RCP<Teuchos::ParameterList> implicitPL =
473 pl->
sublist(
"IMEX-RK Implicit Stepper")));
475 auto stepperTemp = sf->createStepper(implicitPL, Teuchos::null);
479 stepperDIRK == Teuchos::null, std::logic_error,
480 "Error - The implicit component of a general IMEX RK stepper was "
481 "not specified as an DIRK stepper");
482 implicitTableau = stepperDIRK->getTableau();
486 !(explicitTableau != Teuchos::null &&
487 implicitTableau != Teuchos::null),
489 "Error - A parameter list was used to setup a general IMEX RK "
490 "stepper, but did not "
491 "specify both an explicit and an implicit tableau!\n");
493 this->setTableaus(stepperType, explicitTableau, implicitTableau);
494 this->setOrder(pl->
get<
int>(
"overall order", 1));
499 template <
class Scalar>
504 explicitTableau->isImplicit() ==
true, std::logic_error,
505 "Error - Received an implicit Tableau for setExplicitTableau()!\n"
506 <<
" Tableau = " << explicitTableau->description() <<
"\n");
507 explicitTableau_ = explicitTableau;
509 this->isInitialized_ =
false;
512 template <
class Scalar>
517 implicitTableau->isDIRK() !=
true, std::logic_error,
518 "Error - Did not receive a DIRK Tableau for setImplicitTableau()!\n"
519 <<
" Tableau = " << implicitTableau->description() <<
"\n");
520 implicitTableau_ = implicitTableau;
522 this->isInitialized_ =
false;
525 template <
class Scalar>
530 using Teuchos::rcp_const_cast;
531 using Teuchos::rcp_dynamic_cast;
532 RCP<Thyra::ModelEvaluator<Scalar> > ncModel =
534 RCP<WrapperModelEvaluatorPairIMEX_Basic<Scalar> > modelPairIMEX =
537 modelPairIMEX == Teuchos::null, std::logic_error,
538 "Error - StepperIMEX_RK::setModel() was given a ModelEvaluator that\n"
539 <<
" could not be cast to a WrapperModelEvaluatorPairIMEX_Basic!\n"
540 <<
" From: " << appModel <<
"\n"
541 <<
" To : " << modelPairIMEX <<
"\n"
542 <<
" Likely have given the wrong ModelEvaluator to this Stepper.\n");
544 setModelPair(modelPairIMEX);
546 TEUCHOS_TEST_FOR_EXCEPTION(this->solver_ == Teuchos::null, std::logic_error,
547 "Error - Solver is not set!\n");
548 this->solver_->setModel(modelPairIMEX);
550 this->isInitialized_ =
false;
558 template <
class Scalar>
565 this->wrapperModel_);
568 wrapperModelPairIMEX = modelPairIMEX;
569 wrapperModelPairIMEX->initialize();
570 int expXDim = wrapperModelPairIMEX->getExplicitModel()->get_x_space()->dim();
571 int impXDim = wrapperModelPairIMEX->getImplicitModel()->get_x_space()->dim();
573 expXDim != impXDim, std::logic_error,
575 <<
" Explicit and Implicit x vectors are incompatible!\n"
576 <<
" Explicit vector dim = " << expXDim <<
"\n"
577 <<
" Implicit vector dim = " << impXDim <<
"\n");
579 this->wrapperModel_ = wrapperModelPairIMEX;
581 this->isInitialized_ =
false;
589 template <
class Scalar>
596 this->wrapperModel_ =
598 explicitModel, implicitModel));
600 this->isInitialized_ =
false;
603 template <
class Scalar>
607 this->wrapperModel_ == Teuchos::null, std::logic_error,
608 "Error - Need to set the model, setModel(), before calling "
609 "StepperIMEX_RK::initialize()\n");
612 const int numStages = explicitTableau_->numStages();
613 stageF_.resize(numStages);
614 stageG_.resize(numStages);
615 for (
int i = 0; i < numStages; i++) {
616 stageF_[i] = Thyra::createMember(this->wrapperModel_->get_f_space());
617 stageG_[i] = Thyra::createMember(this->wrapperModel_->get_f_space());
622 xTilde_ = Thyra::createMember(this->wrapperModel_->get_x_space());
628 template <
class Scalar>
634 int numStates = solutionHistory->getNumStates();
637 numStates < 1, std::logic_error,
638 "Error - setInitialConditions() needs at least one SolutionState\n"
639 " to set the initial condition. Number of States = "
643 RCP<Teuchos::FancyOStream> out = this->getOStream();
644 Teuchos::OSTab ostab(out, 1,
"StepperIMEX_RK::setInitialConditions()");
645 *out <<
"Warning -- SolutionHistory has more than one state!\n"
646 <<
"Setting the initial conditions on the currentState.\n"
650 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
651 RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
654 auto inArgs = this->wrapperModel_->getNominalValues();
655 if (x == Teuchos::null) {
657 (x == Teuchos::null) && (inArgs.get_x() == Teuchos::null),
659 "Error - setInitialConditions() needs the ICs from the "
660 <<
"SolutionHistory\n"
661 <<
" or getNominalValues()!\n");
664 initialState->setX(x);
668 std::string icConsistency = this->getICConsistency();
670 icConsistency !=
"None", std::logic_error,
671 "Error - setInitialConditions() requested a consistency of '"
673 <<
"'.\n But only 'None' is available for IMEX-RK!\n");
676 this->getUseFSAL(), std::logic_error,
677 "Error - The First-Same-As-Last (FSAL) principle is not "
678 <<
"available for IMEX-RK. Set useFSAL=false.\n");
681 template <
typename Scalar>
684 Scalar stepSize, Scalar stageNumber,
690 this->wrapperModel_);
691 MEB::InArgs<Scalar> inArgs = wrapperModelPairIMEX->createInArgs();
693 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
694 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
695 if (inArgs.supports(MEB::IN_ARG_stage_number))
696 inArgs.set_stage_number(stageNumber);
703 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
705 MEB::OutArgs<Scalar> outArgs = wrapperModelPairIMEX->createOutArgs();
708 wrapperModelPairIMEX->getImplicitModel()->evalModel(inArgs, outArgs);
709 Thyra::Vt_S(G.ptr(), -1.0);
712 template <
typename Scalar>
715 Scalar stepSize, Scalar stageNumber,
722 this->wrapperModel_);
723 MEB::InArgs<Scalar> inArgs =
724 wrapperModelPairIMEX->getExplicitModel()->createInArgs();
726 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
727 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
728 if (inArgs.supports(MEB::IN_ARG_stage_number))
729 inArgs.set_stage_number(stageNumber);
736 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
738 MEB::OutArgs<Scalar> outArgs =
739 wrapperModelPairIMEX->getExplicitModel()->createOutArgs();
742 wrapperModelPairIMEX->getExplicitModel()->evalModel(inArgs, outArgs);
743 Thyra::Vt_S(F.ptr(), -1.0);
746 template <
class Scalar>
750 this->checkInitialized();
756 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperIMEX_RK::takeStep()");
759 solutionHistory->getNumStates() < 2, std::logic_error,
760 "Error - StepperIMEX_RK<Scalar>::takeStep(...)\n"
761 <<
"Need at least two SolutionStates for IMEX_RK.\n"
762 <<
" Number of States = " << solutionHistory->getNumStates()
763 <<
"\nTry setting in \"Solution History\" "
764 <<
"\"Storage Type\" = \"Undo\"\n"
765 <<
" or \"Storage Type\" = \"Static\" and "
766 <<
"\"Storage Limit\" = \"2\"\n");
768 RCP<SolutionState<Scalar> > currentState =
769 solutionHistory->getCurrentState();
770 RCP<SolutionState<Scalar> > workingState =
771 solutionHistory->getWorkingState();
772 const Scalar dt = workingState->getTimeStep();
773 const Scalar time = currentState->getTime();
775 const int numStages = explicitTableau_->numStages();
776 const SerialDenseMatrix<int, Scalar>& AHat = explicitTableau_->A();
777 const SerialDenseVector<int, Scalar>& bHat = explicitTableau_->b();
778 const SerialDenseVector<int, Scalar>& cHat = explicitTableau_->c();
779 const SerialDenseMatrix<int, Scalar>& A = implicitTableau_->A();
780 const SerialDenseVector<int, Scalar>& b = implicitTableau_->b();
781 const SerialDenseVector<int, Scalar>& c = implicitTableau_->c();
784 Thyra::assign(workingState->getX().ptr(), *(currentState->getX()));
786 RCP<StepperIMEX_RK<Scalar> > thisStepper = Teuchos::rcpFromRef(*
this);
787 this->stepperRKAppAction_->execute(
788 solutionHistory, thisStepper,
792 for (
int i = 0; i < numStages; ++i) {
793 this->setStageNumber(i);
794 Thyra::assign(xTilde_.ptr(), *(currentState->getX()));
795 for (
int j = 0; j < i; ++j) {
797 Thyra::Vp_StV(xTilde_.ptr(), -dt * AHat(i, j), *(stageF_[j]));
799 Thyra::Vp_StV(xTilde_.ptr(), -dt * A(i, j), *(stageG_[j]));
802 this->stepperRKAppAction_->execute(
803 solutionHistory, thisStepper,
806 Scalar ts = time + c(i) * dt;
807 Scalar tHats = time + cHat(i) * dt;
810 bool isNeeded =
false;
811 for (
int k = i + 1; k < numStages; ++k)
812 if (A(k, i) != 0.0) isNeeded =
true;
813 if (b(i) != 0.0) isNeeded =
true;
814 if (isNeeded ==
false) {
819 Thyra::assign(workingState->getX().ptr(), *xTilde_);
820 evalImplicitModelExplicitly(workingState->getX(), ts, dt, i,
826 const Scalar alpha = Scalar(1.0) / (dt * A(i, i));
827 const Scalar beta = Scalar(1.0);
832 alpha, xTilde_.getConst()));
837 this->stepperRKAppAction_->execute(
838 solutionHistory, thisStepper,
842 this->solveImplicitODE(workingState->getX(), stageG_[i], ts, p);
846 this->stepperRKAppAction_->execute(
847 solutionHistory, thisStepper,
851 Thyra::V_StVpStV(stageG_[i].ptr(), -alpha, *workingState->getX(), alpha,
855 this->stepperRKAppAction_->execute(
856 solutionHistory, thisStepper,
858 evalExplicitModel(workingState->getX(), tHats, dt, i, stageF_[i]);
859 this->stepperRKAppAction_->execute(
860 solutionHistory, thisStepper,
865 this->setStageNumber(-1);
868 Thyra::assign((workingState->getX()).ptr(), *(currentState->getX()));
869 for (
int i = 0; i < numStages; ++i) {
871 Thyra::Vp_StV((workingState->getX()).ptr(), -dt * bHat(i),
874 Thyra::Vp_StV((workingState->getX()).ptr(), -dt * b(i), *(stageG_[i]));
881 workingState->setOrder(this->getOrder());
882 workingState->computeNorms(currentState);
883 this->stepperRKAppAction_->execute(
884 solutionHistory, thisStepper,
896 template <
class Scalar>
905 template <
class Scalar>
915 out <<
"--- StepperIMEX_RK_Partition ---\n";
916 out <<
" explicitTableau_ = " << explicitTableau_ << std::endl;
918 explicitTableau_->describe(out, verbLevel);
919 out <<
" implicitTableau_ = " << implicitTableau_ << std::endl;
921 implicitTableau_->describe(out, verbLevel);
922 out <<
" xTilde_ = " << xTilde_ << std::endl;
923 out <<
" stageF_.size() = " << stageF_.size() << std::endl;
924 int numStages = stageF_.size();
925 for (
int i = 0; i < numStages; ++i)
926 out <<
" stageF_[" << i <<
"] = " << stageF_[i] << std::endl;
927 out <<
" stageG_.size() = " << stageG_.size() << std::endl;
928 numStages = stageG_.size();
929 for (
int i = 0; i < numStages; ++i)
930 out <<
" stageG_[" << i <<
"] = " << stageG_[i] << std::endl;
931 out <<
" stepperRKAppAction_= " << this->stepperRKAppAction_ << std::endl;
932 out <<
" order_ = " << order_ << std::endl;
933 out <<
"--------------------------------" << std::endl;
936 template <
class Scalar>
940 bool isValidSetup =
true;
946 this->wrapperModel_);
948 if (wrapperModelPairIMEX->getExplicitModel() == Teuchos::null) {
949 isValidSetup =
false;
950 out <<
"The explicit ModelEvaluator is not set!\n";
953 if (wrapperModelPairIMEX->getImplicitModel() == Teuchos::null) {
954 isValidSetup =
false;
955 out <<
"The implicit ModelEvaluator is not set!\n";
958 if (this->wrapperModel_ == Teuchos::null) {
959 isValidSetup =
false;
960 out <<
"The wrapper ModelEvaluator is not set!\n";
963 if (this->stepperRKAppAction_ == Teuchos::null) {
964 isValidSetup =
false;
965 out <<
"The AppAction is not set!\n";
968 if (explicitTableau_ == Teuchos::null) {
969 isValidSetup =
false;
970 out <<
"The explicit tableau is not set!\n";
973 if (implicitTableau_ == Teuchos::null) {
974 isValidSetup =
false;
975 out <<
"The implicit tableau is not set!\n";
981 template <
class Scalar>
985 auto pl = this->getValidParametersBasicImplicit();
986 pl->template set<int>(
"overall order", this->getOrder());
989 explicitStepper->setTableau(
990 explicitTableau_->A(), explicitTableau_->b(), explicitTableau_->c(),
991 explicitTableau_->order(), explicitTableau_->orderMin(),
992 explicitTableau_->orderMax(), explicitTableau_->bstar());
993 pl->set(
"IMEX-RK Explicit Stepper", *explicitStepper->getValidParameters());
996 implicitStepper->setTableau(
997 implicitTableau_->A(), implicitTableau_->b(), implicitTableau_->c(),
998 implicitTableau_->order(), implicitTableau_->orderMin(),
999 implicitTableau_->orderMax(), implicitTableau_->bstar());
1000 pl->set(
"IMEX-RK Implicit Stepper", *implicitStepper->getValidParameters());
1007 template <
class Scalar>
1013 stepper->setStepperImplicitValues(pl);
1014 stepper->setTableaus(pl, stepperType);
1016 if (model != Teuchos::null) {
1017 stepper->setModel(model);
1018 stepper->initialize();
1025 #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.