9 #ifndef Tempus_StepperIMEX_RK_impl_hpp
10 #define Tempus_StepperIMEX_RK_impl_hpp
12 #include "Thyra_VectorStdOps.hpp"
14 #include "Tempus_StepperFactory.hpp"
21 template<
class Scalar>
25 stepperType !=
"IMEX RK 1st order" &&
26 stepperType !=
"SSP1_111" &&
27 stepperType !=
"IMEX RK SSP2" &&
28 stepperType !=
"IMEX RK SSP3" &&
29 stepperType !=
"SSP3_332" &&
30 stepperType !=
"SSP2_222" &&
31 stepperType !=
"SSP2_222_L" &&
32 stepperType !=
"SSP2_222_A" &&
33 stepperType !=
"IMEX RK ARS 233" &&
34 stepperType !=
"ARS 233" &&
35 stepperType !=
"General IMEX RK", std::logic_error,
36 " 'Stepper Type' (='" + stepperType +
"')\n"
37 " does not match one of the types for this Stepper:\n"
38 " 'IMEX RK 1st order'\n"
46 " 'IMEX RK ARS 233'\n"
48 " 'General IMEX RK'\n");
50 this->setStepperName( stepperType);
51 this->setStepperType( stepperType);
52 this->setUseFSAL(
false);
53 this->setICConsistency(
"None");
54 this->setICConsistencyCheck(
false);
55 this->setZeroInitialGuess(
false);
57 this->setStageNumber(-1);
59 this->setTableaus(stepperType);
60 this->setAppAction(Teuchos::null);
61 this->setDefaultSolver();
65 template<
class Scalar>
70 std::string ICConsistency,
71 bool ICConsistencyCheck,
72 bool zeroInitialGuess,
74 std::string stepperType,
80 stepperType !=
"IMEX RK 1st order" &&
81 stepperType !=
"SSP1_111" &&
82 stepperType !=
"IMEX RK SSP2" &&
83 stepperType !=
"IMEX RK SSP3" &&
84 stepperType !=
"SSP3_332" &&
85 stepperType !=
"SSP2_222" &&
86 stepperType !=
"SSP2_222_L" &&
87 stepperType !=
"SSP2_222_A" &&
88 stepperType !=
"IMEX RK ARS 233" &&
89 stepperType !=
"ARS 233" &&
90 stepperType !=
"General IMEX RK", std::logic_error,
91 " 'Stepper Type' (='" + stepperType +
"')\n"
92 " does not match one of the types for this Stepper:\n"
93 " 'IMEX RK 1st order'\n"
101 " 'IMEX RK ARS 233'\n"
103 " 'General IMEX RK'\n");
105 this->setStepperName( stepperType);
106 this->setStepperType( stepperType);
107 this->setUseFSAL( useFSAL);
108 this->setICConsistency( ICConsistency);
109 this->setICConsistencyCheck( ICConsistencyCheck);
110 this->setZeroInitialGuess( zeroInitialGuess);
112 this->setStageNumber(-1);
114 if ( stepperType ==
"General IMEX RK" ) {
115 this->setExplicitTableau(explicitTableau);
116 this->setImplicitTableau(implicitTableau);
118 this->setTableaus(stepperType);
120 this->setOrder(order);
121 this->setAppAction(stepperRKAppAction);
122 this->setSolver(solver);
124 if (appModel != Teuchos::null) {
125 this->setModel(appModel);
131 template<
class Scalar>
136 if (stepperType ==
"") stepperType =
"IMEX RK SSP2";
138 if (stepperType ==
"IMEX RK 1st order" ) {
146 const Scalar one = ST::one();
147 const Scalar zero = ST::zero();
150 A(0,0) = zero; A(0,1) = zero;
151 A(1,0) = one; A(1,1) = zero;
154 b(0) = one; b(1) = zero;
157 c(0) = zero; c(1) = one;
162 "Explicit Tableau - IMEX RK 1st order",
163 A,b,c,order,order,order));
164 expTableau->setTVD(
true);
165 expTableau->setTVDCoeff(2.0);
167 this->setExplicitTableau(expTableau);
173 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
177 const Scalar one = ST::one();
178 const Scalar zero = ST::zero();
181 A(0,0) = zero; A(0,1) = zero;
182 A(1,0) = zero; A(1,1) = one;
185 b(0) = zero; b(1) = one;
188 c(0) = zero; c(1) = one;
193 "Implicit Tableau - IMEX RK 1st order",
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" )
209 const int NumStages = 1;
214 const Scalar one = ST::one();
215 const Scalar zero = ST::zero();
227 "Explicit Tableau - SSP1_111",A,b,c,order,order,order));
228 expTableau->setTVD(
true);
229 expTableau->setTVDCoeff(1.0);
231 this->setExplicitTableau(expTableau);
236 const int NumStages = 1;
238 const Scalar sspcoef = std::numeric_limits<Scalar>::max();
242 const Scalar one = ST::one();
254 "Implicit Tableau - SSP1_111",
255 A,b,c,order,order,order));
256 impTableau->setTVD(
true);
257 impTableau->setTVDCoeff(sspcoef);
259 this->setImplicitTableau(impTableau);
261 this->setStepperName(
"SSP1_111");
262 this->setStepperType(
"SSP1_111");
265 }
else if (stepperType ==
"IMEX RK SSP2" || stepperType ==
"SSP2_222_L" ) {
268 this->setExplicitTableau(stepperERK->getTableau());
272 stepperSDIRK->setGammaType(
"2nd Order L-stable");
273 this->setImplicitTableau(stepperSDIRK->getTableau());
275 this->setStepperName(
"IMEX RK SSP2");
276 this->setStepperType(
"IMEX RK SSP2");
278 }
else if (stepperType ==
"SSP2_222" || stepperType ==
"SSP2_222_A" ) {
281 this->setExplicitTableau(stepperERK->getTableau());
285 stepperSDIRK->setGammaType(
"gamma");
286 stepperSDIRK->setGamma( 0.5 );
287 this->setImplicitTableau(stepperSDIRK->getTableau());
289 this->setStepperName(
"SSP2_222");
290 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");
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);
317 A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
318 A(1,0) = gamma; A(1,1) = zero; A(1,2) = zero;
319 A(2,0) = (gamma-1.0); A(2,1) = (2.0-2.0*gamma); A(2,2) = zero;
322 b(0) = zero; b(1) = onehalf; b(2) = onehalf;
325 c(0) = zero; c(1) = gamma; c(2) = one-gamma;
330 "Partition IMEX-RK Explicit Stepper",A,b,c,order,order,order));
332 this->setExplicitTableau(expTableau);
337 A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
338 A(1,0) = zero; A(1,1) = gamma; A(1,2) = zero;
339 A(2,0) = zero; A(2,1) = (1.0-2.0*gamma); A(2,2) = gamma;
342 b(0) = zero; b(1) = onehalf; b(2) = onehalf;
345 c(0) = zero; c(1) = gamma; c(2) = one-gamma;
350 "Partition IMEX-RK Implicit Stepper",A,b,c,order,order,order));
352 this->setImplicitTableau(impTableau);
354 this->setStepperName(
"IMEX RK ARS 233");
355 this->setStepperType(
"IMEX RK ARS 233");
358 }
else if (stepperType ==
"General IMEX RK") {
360 if (explicitTableau == Teuchos::null) {
363 this->setExplicitTableau(stepperERK->getTableau());
365 this->setExplicitTableau(explicitTableau);
368 if (explicitTableau == Teuchos::null) {
371 stepperSDIRK->setGammaType(
"2nd Order L-stable");
372 this->setImplicitTableau(stepperSDIRK->getTableau());
374 this->setImplicitTableau(implicitTableau);
377 this->setStepperName(
"General IMEX RK");
378 this->setStepperType(
"General IMEX RK");
383 "Error - Not a valid StepperIMEX_RK type! Stepper Type = "
384 << stepperType <<
"\n"
385 <<
" Current valid types are: \n"
386 <<
" 'IMEX RK 1st order\n"
388 <<
" 'IMEX RK SSP2' ('SSP2_222_L')\n"
389 <<
" 'SSP2_222' ('SSP2_222_A')\n"
390 <<
" 'IMEX RK SSP3' ('SSP3_332')\n"
391 <<
" 'IMEX RK ARS 233' ('ARS 233')\n"
392 <<
" 'General IMEX RK'\n");
397 "Error - StepperIMEX_RK - Explicit tableau is null!");
400 "Error - StepperIMEX_RK - Implicit tableau is null!");
402 explicitTableau_->numStages()!=implicitTableau_->numStages(),
404 "Error - StepperIMEX_RK - Number of stages do not match!\n"
405 <<
" Explicit tableau = " << explicitTableau_->description() <<
"\n"
406 <<
" number of stages = " << explicitTableau_->numStages() <<
"\n"
407 <<
" Implicit tableau = " << implicitTableau_->description() <<
"\n"
408 <<
" number of stages = " << implicitTableau_->numStages() <<
"\n");
410 this->isInitialized_ =
false;
414 template<
class Scalar>
418 std::string stepperType)
421 if (stepperType ==
"") {
422 if (pl == Teuchos::null)
423 stepperType =
"IMEX RK SSP2";
425 stepperType = pl->
get<std::string>(
"Stepper Type",
"IMEX RK SSP2");
428 if (stepperType !=
"General IMEX RK") {
429 this->setTableaus(stepperType);
431 if (pl != Teuchos::null) {
434 if (pl->
isSublist(
"IMEX-RK Explicit Stepper")) {
438 auto stepperTemp = sf->createStepper(explicitPL, Teuchos::null);
442 "Error - The explicit component of a general IMEX RK stepper was not specified as an ExplicitRK stepper");
443 explicitTableau = stepperERK->getTableau();
446 if (pl->
isSublist(
"IMEX-RK Implicit Stepper")) {
450 auto stepperTemp = sf->createStepper(implicitPL, Teuchos::null);
454 "Error - The implicit component of a general IMEX RK stepper was not specified as an DIRK stepper");
455 implicitTableau = stepperDIRK->getTableau();
459 !(explicitTableau!=Teuchos::null && implicitTableau!=Teuchos::null), std::logic_error,
460 "Error - A parameter list was used to setup a general IMEX RK stepper, but did not "
461 "specify both an explicit and an implicit tableau!\n");
463 this->setTableaus(stepperType, explicitTableau, implicitTableau);
464 this->setOrder(pl->
get<
int>(
"overall order", 1));
470 template<
class Scalar>
476 "Error - Received an implicit Tableau for setExplicitTableau()!\n" <<
477 " Tableau = " << explicitTableau->description() <<
"\n");
478 explicitTableau_ = explicitTableau;
480 this->isInitialized_ =
false;
484 template<
class Scalar>
490 "Error - Did not receive a DIRK Tableau for setImplicitTableau()!\n" <<
491 " Tableau = " << implicitTableau->description() <<
"\n");
492 implicitTableau_ = implicitTableau;
494 this->isInitialized_ =
false;
497 template<
class Scalar>
502 using Teuchos::rcp_const_cast;
503 using Teuchos::rcp_dynamic_cast;
504 RCP<Thyra::ModelEvaluator<Scalar> > ncModel =
506 RCP<WrapperModelEvaluatorPairIMEX_Basic<Scalar> > modelPairIMEX =
509 "Error - StepperIMEX_RK::setModel() was given a ModelEvaluator that\n"
510 " could not be cast to a WrapperModelEvaluatorPairIMEX_Basic!\n"
511 " From: " << appModel <<
"\n"
512 " To : " << modelPairIMEX <<
"\n"
513 " Likely have given the wrong ModelEvaluator to this Stepper.\n");
515 setModelPair(modelPairIMEX);
517 TEUCHOS_TEST_FOR_EXCEPTION(this->solver_ == Teuchos::null, std::logic_error,
518 "Error - Solver is not set!\n");
519 this->solver_->setModel(modelPairIMEX);
521 this->isInitialized_ =
false;
530 template<
class Scalar>
537 this->wrapperModel_);
540 wrapperModelPairIMEX = modelPairIMEX;
541 wrapperModelPairIMEX->initialize();
542 int expXDim = wrapperModelPairIMEX->getExplicitModel()->get_x_space()->dim();
543 int impXDim = wrapperModelPairIMEX->getImplicitModel()->get_x_space()->dim();
546 " Explicit and Implicit x vectors are incompatible!\n"
547 " Explicit vector dim = " << expXDim <<
"\n"
548 " Implicit vector dim = " << impXDim <<
"\n");
550 this->wrapperModel_ = wrapperModelPairIMEX;
552 this->isInitialized_ =
false;
560 template<
class Scalar>
569 explicitModel, implicitModel));
571 this->isInitialized_ =
false;
575 template<
class Scalar>
580 "Error - Need to set the model, setModel(), before calling "
581 "StepperIMEX_RK::initialize()\n");
584 const int numStages = explicitTableau_->numStages();
585 stageF_.resize(numStages);
586 stageG_.resize(numStages);
587 for(
int i=0; i < numStages; i++) {
588 stageF_[i] = Thyra::createMember(this->wrapperModel_->get_f_space());
589 stageG_[i] = Thyra::createMember(this->wrapperModel_->get_f_space());
594 xTilde_ = Thyra::createMember(this->wrapperModel_->get_x_space());
601 template<
class Scalar>
607 int numStates = solutionHistory->getNumStates();
610 "Error - setInitialConditions() needs at least one SolutionState\n"
611 " to set the initial condition. Number of States = " << numStates);
614 RCP<Teuchos::FancyOStream> out = this->getOStream();
615 Teuchos::OSTab ostab(out,1,
"StepperIMEX_RK::setInitialConditions()");
616 *out <<
"Warning -- SolutionHistory has more than one state!\n"
617 <<
"Setting the initial conditions on the currentState.\n"<<std::endl;
620 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
621 RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
624 auto inArgs = this->wrapperModel_->getNominalValues();
625 if (x == Teuchos::null) {
627 (inArgs.get_x() == Teuchos::null), std::logic_error,
628 "Error - setInitialConditions() needs the ICs from the SolutionHistory\n"
629 " or getNominalValues()!\n");
632 initialState->setX(x);
636 std::string icConsistency = this->getICConsistency();
638 "Error - setInitialConditions() requested a consistency of '"
639 << icConsistency <<
"'.\n"
640 " But only 'None' is available for IMEX-RK!\n");
643 "Error - The First-Same-As-Last (FSAL) principle is not "
644 <<
"available for IMEX-RK. Set useFSAL=false.\n");
648 template <
typename Scalar>
651 Scalar time, Scalar stepSize, Scalar stageNumber,
657 this->wrapperModel_);
658 MEB::InArgs<Scalar> inArgs = wrapperModelPairIMEX->getInArgs();
660 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time);
661 if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(stepSize);
662 if (inArgs.supports(MEB::IN_ARG_stage_number))
663 inArgs.set_stage_number(stageNumber);
670 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
672 MEB::OutArgs<Scalar> outArgs = wrapperModelPairIMEX->getOutArgs();
675 wrapperModelPairIMEX->getImplicitModel()->evalModel(inArgs,outArgs);
676 Thyra::Vt_S(G.ptr(), -1.0);
680 template <
typename Scalar>
683 Scalar time, Scalar stepSize, Scalar stageNumber,
690 this->wrapperModel_);
691 MEB::InArgs<Scalar> inArgs =
692 wrapperModelPairIMEX->getExplicitModel()->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 =
707 wrapperModelPairIMEX->getExplicitModel()->createOutArgs();
710 wrapperModelPairIMEX->getExplicitModel()->evalModel(inArgs, outArgs);
711 Thyra::Vt_S(F.ptr(), -1.0);
715 template<
class Scalar>
719 this->checkInitialized();
725 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperIMEX_RK::takeStep()");
729 "Error - StepperIMEX_RK<Scalar>::takeStep(...)\n"
730 "Need at least two SolutionStates for IMEX_RK.\n"
731 " Number of States = " << solutionHistory->getNumStates() <<
"\n"
732 "Try setting in \"Solution History\" \"Storage Type\" = \"Undo\"\n"
733 " or \"Storage Type\" = \"Static\" and \"Storage Limit\" = \"2\"\n");
735 RCP<SolutionState<Scalar> > currentState=solutionHistory->getCurrentState();
736 RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
737 const Scalar dt = workingState->getTimeStep();
738 const Scalar time = currentState->getTime();
740 const int numStages = explicitTableau_->numStages();
741 const SerialDenseMatrix<int,Scalar> & AHat = explicitTableau_->A();
742 const SerialDenseVector<int,Scalar> & bHat = explicitTableau_->b();
743 const SerialDenseVector<int,Scalar> & cHat = explicitTableau_->c();
744 const SerialDenseMatrix<int,Scalar> & A = implicitTableau_->A();
745 const SerialDenseVector<int,Scalar> & b = implicitTableau_->b();
746 const SerialDenseVector<int,Scalar> & c = implicitTableau_->c();
749 Thyra::assign(workingState->getX().ptr(), *(currentState->getX()));
751 RCP<StepperIMEX_RK<Scalar> > thisStepper = Teuchos::rcpFromRef(*
this);
752 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
756 for (
int i = 0; i < numStages; ++i) {
757 this->setStageNumber(i);
758 Thyra::assign(xTilde_.ptr(), *(currentState->getX()));
759 for (
int j = 0; j < i; ++j) {
761 Thyra::Vp_StV(xTilde_.ptr(), -dt*AHat(i,j), *(stageF_[j]));
763 Thyra::Vp_StV(xTilde_.ptr(), -dt*A (i,j), *(stageG_[j]));
766 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
769 Scalar ts = time + c(i)*dt;
770 Scalar tHats = time + cHat(i)*dt;
773 bool isNeeded =
false;
774 for (
int k=i+1; k<numStages; ++k)
if (A(k,i) != 0.0) isNeeded =
true;
775 if (b(i) != 0.0) isNeeded =
true;
776 if (isNeeded ==
false) {
780 Thyra::assign(workingState->getX().ptr(), *xTilde_);
781 evalImplicitModelExplicitly(workingState->getX(), ts, dt, i, stageG_[i]);
785 const Scalar alpha = Scalar(1.0)/(dt*A(i,i));
786 const Scalar beta = Scalar(1.0);
791 alpha, xTilde_.getConst()));
796 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
800 this->solveImplicitODE(workingState->getX(), stageG_[i], ts, p);
804 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
808 Thyra::V_StVpStV(stageG_[i].ptr(), -alpha, *workingState->getX(), alpha, *xTilde_);
811 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
813 evalExplicitModel(workingState->getX(), tHats, dt, i, stageF_[i]);
814 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
819 this->setStageNumber(-1);
822 Thyra::assign((workingState->getX()).ptr(), *(currentState->getX()));
823 for (
int i=0; i < numStages; ++i) {
825 Thyra::Vp_StV((workingState->getX()).ptr(), -dt*bHat(i), *(stageF_[i]));
827 Thyra::Vp_StV((workingState->getX()).ptr(), -dt*b (i), *(stageG_[i]));
830 if (pass ==
true) workingState->setSolutionStatus(
Status::PASSED);
832 workingState->setOrder(this->getOrder());
833 workingState->computeNorms(currentState);
834 this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
846 template<
class Scalar>
857 template<
class Scalar>
866 out <<
"--- StepperIMEX_RK_Partition ---\n";
867 out <<
" explicitTableau_ = " << explicitTableau_ << std::endl;
869 explicitTableau_->describe(out, verbLevel);
870 out <<
" implicitTableau_ = " << implicitTableau_ << std::endl;
872 implicitTableau_->describe(out, verbLevel);
873 out <<
" xTilde_ = " << xTilde_ << std::endl;
874 out <<
" stageF_.size() = " << stageF_.size() << std::endl;
875 int numStages = stageF_.size();
876 for (
int i=0; i<numStages; ++i)
877 out <<
" stageF_["<<i<<
"] = " << stageF_[i] << std::endl;
878 out <<
" stageG_.size() = " << stageG_.size() << std::endl;
879 numStages = stageG_.size();
880 for (
int i=0; i<numStages; ++i)
881 out <<
" stageG_["<<i<<
"] = " << stageG_[i] << std::endl;
882 out <<
" stepperRKAppAction_= " << this->stepperRKAppAction_ << std::endl;
883 out <<
" order_ = " << order_ << std::endl;
884 out <<
"--------------------------------" << std::endl;
888 template<
class Scalar>
891 bool isValidSetup =
true;
897 this->wrapperModel_);
899 if ( wrapperModelPairIMEX->getExplicitModel() == Teuchos::null) {
900 isValidSetup =
false;
901 out <<
"The explicit ModelEvaluator is not set!\n";
904 if ( wrapperModelPairIMEX->getImplicitModel() == Teuchos::null) {
905 isValidSetup =
false;
906 out <<
"The implicit ModelEvaluator is not set!\n";
909 if (this->wrapperModel_ == Teuchos::null) {
910 isValidSetup =
false;
911 out <<
"The wrapper ModelEvaluator is not set!\n";
914 if (this->stepperRKAppAction_ == Teuchos::null) {
915 isValidSetup =
false;
916 out <<
"The AppAction is not set!\n";
919 if ( explicitTableau_ == Teuchos::null ) {
920 isValidSetup =
false;
921 out <<
"The explicit tableau is not set!\n";
924 if ( implicitTableau_ == Teuchos::null ) {
925 isValidSetup =
false;
926 out <<
"The implicit tableau is not set!\n";
933 template<
class Scalar>
937 auto pl = this->getValidParametersBasicImplicit();
938 pl->template set<int>(
"overall order", this->getOrder());
941 explicitStepper->setTableau(
942 explicitTableau_->A(), explicitTableau_->b(), explicitTableau_->c(),
943 explicitTableau_->order(), explicitTableau_->orderMin(),
944 explicitTableau_->orderMax(), explicitTableau_->bstar() );
945 pl->set(
"IMEX-RK Explicit Stepper", *explicitStepper->getValidParameters());
948 implicitStepper->setTableau(
949 implicitTableau_->A(), implicitTableau_->b(), implicitTableau_->c(),
950 implicitTableau_->order(), implicitTableau_->orderMin(),
951 implicitTableau_->orderMax(), implicitTableau_->bstar() );
952 pl->set(
"IMEX-RK Implicit Stepper", *implicitStepper->getValidParameters());
960 template<
class Scalar>
964 std::string stepperType,
969 stepper->setStepperImplicitValues(pl);
970 stepper->setTableaus(pl, stepperType);
972 if (model != Teuchos::null) {
973 stepper->setModel(model);
974 stepper->initialize();
982 #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.
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...
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 describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
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.