9 #ifndef Tempus_StepperIMEX_RK_Partition_impl_hpp 
   10 #define Tempus_StepperIMEX_RK_Partition_impl_hpp 
   12 #include "Thyra_VectorStdOps.hpp" 
   14 #include "Tempus_StepperFactory.hpp" 
   21 template<
class Scalar>
 
   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",       std::logic_error,
 
   29     "  'Stepper Type' (='" + stepperType +
"')\n" 
   30     "  does not match one of the types for this Stepper:\n" 
   31     "    'Partitioned IMEX RK 1st order'\n" 
   32     "    'Partitioned IMEX RK SSP2'\n" 
   33     "    'Partitioned IMEX RK ARS 233'\n" 
   34     "    'General Partitioned IMEX RK'\n");
 
   36   this->setStepperName(        
"Partitioned IMEX RK SSP2");
 
   37   this->setStepperType(        
"Partitioned IMEX RK SSP2");
 
   38   this->setUseFSAL(            
false);
 
   39   this->setICConsistency(      
"None");
 
   40   this->setICConsistencyCheck( 
false);
 
   41   this->setZeroInitialGuess(   
false);
 
   43   this->setStageNumber(-1);
 
   45   this->setTableaus(stepperType);
 
   46   this->setAppAction(Teuchos::null);
 
   47   this->setDefaultSolver();
 
   51 template<
class Scalar>
 
   56   std::string ICConsistency,
 
   57   bool ICConsistencyCheck,
 
   58   bool zeroInitialGuess,
 
   60   std::string stepperType,
 
   66     stepperType != 
"Partitioned IMEX RK 1st order" &&
 
   67     stepperType != 
"Partitioned IMEX RK SSP2"      &&
 
   68     stepperType != 
"Partitioned IMEX RK ARS 233"   &&
 
   69     stepperType != 
"General Partitioned IMEX RK",       std::logic_error,
 
   70     "  'Stepper Type' (='" + stepperType +
"')\n" 
   71     "  does not match one of the types for this Stepper:\n" 
   72     "    'Partitioned IMEX RK 1st order'\n" 
   73     "    'Partitioned IMEX RK SSP2'\n" 
   74     "    'Partitioned IMEX RK ARS 233'\n" 
   75     "    'General Partitioned IMEX RK'\n");
 
   77   this->setStepperName(        stepperType);
 
   78   this->setStepperType(        stepperType);
 
   79   this->setUseFSAL(            useFSAL);
 
   80   this->setICConsistency(      ICConsistency);
 
   81   this->setICConsistencyCheck( ICConsistencyCheck);
 
   82   this->setZeroInitialGuess(   zeroInitialGuess);
 
   83   this->setOrder(              order);
 
   85   this->setStageNumber(-1);
 
   87   if ( stepperType == 
"General Partitioned IMEX RK" ) {
 
   88     this->setExplicitTableau(explicitTableau);
 
   89     this->setImplicitTableau(implicitTableau);
 
   91     this->setTableaus(stepperType);
 
   93   this->setAppAction(stepperRKAppAction);
 
   94   this->setSolver(solver);
 
   96   if (appModel != Teuchos::null) {
 
   97     this->setModel(appModel);
 
  103 template<
class Scalar>
 
  105   std::string stepperType,
 
  109   if (stepperType == 
"") stepperType = 
"Partitioned IMEX RK SSP2";
 
  111   if (stepperType == 
"Partitioned IMEX RK 1st order") {
 
  119       const Scalar one = ST::one();
 
  120       const Scalar zero = ST::zero();
 
  123       A(0,0) = zero; A(0,1) = zero;
 
  124       A(1,0) =  one; A(1,1) = zero;
 
  127       b(0) = one; b(1) = zero;
 
  130       c(0) = zero; c(1) = one;
 
  135         "Explicit Tableau - Partitioned IMEX RK 1st order",
 
  136         A,b,c,order,order,order));
 
  137       expTableau->setTVD(
true);
 
  138       expTableau->setTVDCoeff(2.0);
 
  140       this->setExplicitTableau(expTableau);
 
  146       const Scalar sspcoef =  std::numeric_limits<Scalar>::max();
 
  150       const Scalar one = ST::one();
 
  151       const Scalar zero = ST::zero();
 
  154       A(0,0) = zero; A(0,1) = zero;
 
  155       A(1,0) = zero; A(1,1) =  one;
 
  158       b(0) = zero; b(1) = one;
 
  161       c(0) = zero; c(1) = one;
 
  166         "Implicit Tableau - Partitioned IMEX RK 1st order",
 
  167         A,b,c,order,order,order));
 
  168       impTableau->setTVD(
true);
 
  169       impTableau->setTVDCoeff(sspcoef);
 
  171       this->setImplicitTableau(impTableau);
 
  173     this->setStepperName(
"Partitioned IMEX RK 1st order");
 
  174     this->setStepperType(
"Partitioned IMEX RK 1st order");
 
  177   } 
else if (stepperType == 
"Partitioned IMEX RK SSP2") {
 
  180     this->setExplicitTableau(stepperERK->getTableau());
 
  184     stepperSDIRK->setGammaType(
"2nd Order L-stable");
 
  185     this->setImplicitTableau(stepperSDIRK->getTableau());
 
  187     this->setStepperName(
"Partitioned IMEX RK SSP2");
 
  188     this->setStepperType(
"Partitioned IMEX RK SSP2");
 
  191   } 
else if (stepperType == 
"Partitioned IMEX RK ARS 233") {
 
  197     const Scalar one = ST::one();
 
  198     const Scalar zero = ST::zero();
 
  199     const Scalar onehalf = ST::one()/(2*ST::one());
 
  200     const Scalar gamma = (3*one+ST::squareroot(3*one))/(6*one);
 
  204       A(0,0) =        zero; A(0,1) =            zero; A(0,2) = zero;
 
  205       A(1,0) =       gamma; A(1,1) =            zero; A(1,2) = zero;
 
  206       A(2,0) = (gamma-1.0); A(2,1) = (2.0-2.0*gamma); A(2,2) = zero;
 
  209       b(0) = zero; b(1) = onehalf; b(2) = onehalf;
 
  212       c(0) = zero; c(1) = gamma; c(2) = one-gamma;
 
  217         "Explicit Tableau - Partitioned IMEX RK ARS 233",
 
  218         A,b,c,order,order,order));
 
  220       this->setExplicitTableau(expTableau);
 
  225       A(0,0) = zero; A(0,1) =            zero; A(0,2) =  zero;
 
  226       A(1,0) = zero; A(1,1) =           gamma; A(1,2) =  zero;
 
  227       A(2,0) = zero; A(2,1) = (1.0-2.0*gamma); A(2,2) = gamma;
 
  230       b(0) = zero; b(1) = onehalf; b(2) = onehalf;
 
  233       c(0) = zero; c(1) = gamma; c(2) = one-gamma;
 
  238         "Implicit Tableau - Partitioned IMEX RK ARS 233",
 
  239         A,b,c,order,order,order));
 
  241       this->setImplicitTableau(impTableau);
 
  243     this->setStepperName(
"Partitioned IMEX RK ARS 233");
 
  244     this->setStepperType(
"Partitioned IMEX RK ARS 233");
 
  247   } 
else if (stepperType == 
"General Partitioned IMEX RK") {
 
  249     if ( explicitTableau == Teuchos::null ) {
 
  252       this->setExplicitTableau(stepperERK->getTableau());
 
  254       this->setExplicitTableau(explicitTableau);
 
  257     if ( implicitTableau == Teuchos::null ) {
 
  260       stepperSDIRK->setGammaType(
"2nd Order L-stable");
 
  261       this->setImplicitTableau(stepperSDIRK->getTableau());
 
  263       this->setImplicitTableau(implicitTableau);
 
  266     this->setStepperName(
"General Partitioned IMEX RK");
 
  267     this->setStepperType(
"General Partitioned IMEX RK");
 
  272        "Error - Not a valid StepperIMEX_RK_Partition type!  Stepper Type = " 
  273        << stepperType <<  
"\n" 
  274        << 
"  Current valid types are: " << 
"\n" 
  275        << 
"      'Partitioned IMEX RK 1st order'" << 
"\n" 
  276        << 
"      'Partitioned IMEX RK SSP2'" << 
"\n" 
  277        << 
"      'Partitioned IMEX RK ARS 233'" << 
"\n" 
  278        << 
"      'General Partitioned IMEX RK'" << 
"\n");
 
  283     "Error - StepperIMEX_RK_Partition - Explicit tableau is null!");
 
  286     "Error - StepperIMEX_RK_Partition - Implicit tableau is null!");
 
  288     explicitTableau_->numStages()!=implicitTableau_->numStages(),
 
  290        "Error - StepperIMEX_RK_Partition - Number of stages do not match!\n" 
  291     << 
"  Explicit tableau = " << explicitTableau_->description() << 
"\n" 
  292     << 
"    number of stages = " << explicitTableau_->numStages() << 
"\n" 
  293     << 
"  Implicit tableau = " << implicitTableau_->description() << 
"\n" 
  294     << 
"    number of stages = " << implicitTableau_->numStages() << 
"\n");
 
  296   this->isInitialized_ = 
false;
 
  300 template<
class Scalar>
 
  305   std::string stepperType)
 
  308   if (stepperType == 
"") {
 
  309     if (pl == Teuchos::null)
 
  310       stepperType = 
"Partitioned IMEX RK SSP2";
 
  312       stepperType = pl->
get<std::string>(
"Stepper Type", 
"Partitioned IMEX RK SSP2");
 
  315   if (stepperType != 
"General Partitioned IMEX RK") {
 
  316     this->setTableaus(stepperType);
 
  318     if (pl != Teuchos::null) {
 
  321       if (pl->
isSublist(
"IMEX-RK Explicit Stepper")) {
 
  325         auto stepperTemp = sf->createStepper(explicitPL, Teuchos::null);
 
  329             "Error - The explicit component of a general partitioned IMEX RK stepper was not specified as an ExplicitRK stepper");
 
  330         explicitTableau = stepperERK->getTableau();
 
  333       if (pl->
isSublist(
"IMEX-RK Implicit Stepper")) {
 
  337         auto stepperTemp = sf->createStepper(implicitPL, Teuchos::null);
 
  341             "Error - The implicit component of a general partitioned IMEX RK stepper was not specified as an DIRK stepper");
 
  342         implicitTableau = stepperDIRK->getTableau();
 
  346         !(explicitTableau!=Teuchos::null && implicitTableau!=Teuchos::null), std::logic_error,
 
  347         "Error - A parameter list was used to setup a general partitioned IMEX RK stepper, but did not " 
  348         "specify both an explicit and an implicit tableau!\n");
 
  350       this->setTableaus(stepperType, explicitTableau, implicitTableau);
 
  352       this->setOrder(pl->
get<
int>(
"overall order", 1));
 
  358 template<
class Scalar>
 
  364     "Error - Received an implicit Tableau for setExplicitTableau()!\n" <<
 
  365     "        Tableau = " << explicitTableau->description() << 
"\n");
 
  366   explicitTableau_ = explicitTableau;
 
  368   this->isInitialized_ = 
false;
 
  372 template<
class Scalar>
 
  378     "Error - Did not receive a DIRK Tableau for setImplicitTableau()!\n" <<
 
  379     "        Tableau = " << implicitTableau->description() << 
"\n");
 
  380   implicitTableau_ = implicitTableau;
 
  382   this->isInitialized_ = 
false;
 
  385 template<
class Scalar>
 
  390   using Teuchos::rcp_const_cast;
 
  391   using Teuchos::rcp_dynamic_cast;
 
  392   RCP<Thyra::ModelEvaluator<Scalar> > ncModel =
 
  394   RCP<WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> > modelPairIMEX =
 
  397     "Error - StepperIMEX_RK::setModel() was given a ModelEvaluator that\n" 
  398     "  could not be cast to a WrapperModelEvaluatorPairPartIMEX_Basic!\n" 
  399     "  From: " << appModel << 
"\n" 
  400     "  To  : " << modelPairIMEX << 
"\n" 
  401     "  Likely have given the wrong ModelEvaluator to this Stepper.\n");
 
  403   setModelPair(modelPairIMEX);
 
  405   this->isInitialized_ = 
false;
 
  413 template<
class Scalar>
 
  419     wrapperModelPairIMEX =
 
  421       (this->wrapperModel_);
 
  424   wrapperModelPairIMEX = mePairIMEX;
 
  425   wrapperModelPairIMEX->initialize();
 
  427   this->wrapperModel_ = wrapperModelPairIMEX;
 
  429   this->isInitialized_ = 
false;
 
  437 template<
class Scalar>
 
  446                                              explicitModel, implicitModel));
 
  448   this->isInitialized_ = 
false;
 
  452 template<
class Scalar>
 
  456     wrapperModelPairIMEX =
 
  458       (this->wrapperModel_);
 
  461     "Error - Can not cast the wrapper Model Evaluator to a IMEX Model Pair." 
  462     "StepperIMEX_RK_Partition::initialize()\n");
 
  465   const int numStages = explicitTableau_->numStages();
 
  466   stageF_.resize(numStages);
 
  467   stageGx_.resize(numStages);
 
  468   for(
int i=0; i < numStages; i++) {
 
  469     stageF_[i] = Thyra::createMember(wrapperModelPairIMEX->
 
  470                                      getExplicitModel()->get_f_space());
 
  471     stageGx_[i] = Thyra::createMember(wrapperModelPairIMEX->
 
  472                                      getImplicitModel()->get_f_space());
 
  477   xTilde_ = Thyra::createMember(wrapperModelPairIMEX->
 
  478                                 getImplicitModel()->get_x_space());
 
  485 template<
class Scalar>
 
  491   int numStates = solutionHistory->getNumStates();
 
  494     "Error - setInitialConditions() needs at least one SolutionState\n" 
  495     "        to set the initial condition.  Number of States = " << numStates);
 
  498     RCP<Teuchos::FancyOStream> out = this->getOStream();
 
  499     Teuchos::OSTab ostab(out,1,
"StepperIMEX_RK::setInitialConditions()");
 
  500     *out << 
"Warning -- SolutionHistory has more than one state!\n" 
  501          << 
"Setting the initial conditions on the currentState.\n"<<std::endl;
 
  504   RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
 
  505   RCP<Thyra::VectorBase<Scalar> > x = initialState->getX();
 
  508   auto inArgs = this->wrapperModel_->getNominalValues();
 
  509   if (x == Teuchos::null) {
 
  511       (inArgs.get_x() == Teuchos::null), std::logic_error,
 
  512       "Error - setInitialConditions() needs the ICs from the SolutionHistory\n" 
  513       "        or getNominalValues()!\n");
 
  516     initialState->setX(x);
 
  521   std::string icConsistency = this->getICConsistency();
 
  523     "Error - setInitialConditions() requested a consistency of '" 
  524              << icConsistency << 
"'.\n" 
  525     "        But only 'None' is available for IMEX-RK!\n");
 
  528     "Error - The First-Same-As-Last (FSAL) principle is not " 
  529          << 
"available for IMEX-RK.  Set useFSAL=false.\n");
 
  533 template <
typename Scalar>
 
  537   Scalar time, Scalar stepSize, Scalar stageNumber,
 
  542     wrapperModelPairIMEX =
 
  544       (this->wrapperModel_);
 
  545   MEB::InArgs<Scalar>  inArgs = wrapperModelPairIMEX->getInArgs();
 
  547   inArgs.set_p(wrapperModelPairIMEX->getParameterIndex(), Y);
 
  548   if (inArgs.supports(MEB::IN_ARG_t))           inArgs.set_t(time);
 
  549   if (inArgs.supports(MEB::IN_ARG_step_size))   inArgs.set_step_size(stepSize);
 
  550   if (inArgs.supports(MEB::IN_ARG_stage_number))
 
  551     inArgs.set_stage_number(stageNumber);
 
  558   if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
 
  560   MEB::OutArgs<Scalar> outArgs = wrapperModelPairIMEX->getOutArgs();
 
  563   wrapperModelPairIMEX->getImplicitModel()->evalModel(inArgs,outArgs);
 
  564   Thyra::Vt_S(G.ptr(), -1.0);
 
  568 template <
typename Scalar>
 
  571   Scalar time, Scalar stepSize, Scalar stageNumber,
 
  577     wrapperModelPairIMEX =
 
  579       (this->wrapperModel_);
 
  580   MEB::InArgs<Scalar> inArgs =
 
  581     wrapperModelPairIMEX->getExplicitModel()->createInArgs();
 
  583   if (inArgs.supports(MEB::IN_ARG_t))           inArgs.set_t(time);
 
  584   if (inArgs.supports(MEB::IN_ARG_step_size))   inArgs.set_step_size(stepSize);
 
  585   if (inArgs.supports(MEB::IN_ARG_stage_number))
 
  586     inArgs.set_stage_number(stageNumber);
 
  593   if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(Teuchos::null);
 
  595   MEB::OutArgs<Scalar> outArgs =
 
  596     wrapperModelPairIMEX->getExplicitModel()->createOutArgs();
 
  599   wrapperModelPairIMEX->getExplicitModel()->evalModel(inArgs, outArgs);
 
  600   Thyra::Vt_S(F.ptr(), -1.0);
 
  604 template<
class Scalar>
 
  608   this->checkInitialized();
 
  614   TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperIMEX_RK_Partition::takeStep()");
 
  618       "Error - StepperIMEX_RK_Partition<Scalar>::takeStep(...)\n" 
  619       "Need at least two SolutionStates for IMEX_RK_Partition.\n" 
  620       "  Number of States = " << solutionHistory->getNumStates() << 
"\n" 
  621       "Try setting in \"Solution History\" \"Storage Type\" = \"Undo\"\n" 
  622       "  or \"Storage Type\" = \"Static\" and \"Storage Limit\" = \"2\"\n");
 
  624     RCP<SolutionState<Scalar> > currentState=solutionHistory->getCurrentState();
 
  625     RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
 
  626     const Scalar dt = workingState->getTimeStep();
 
  627     const Scalar time = currentState->getTime();
 
  629     const int numStages = explicitTableau_->numStages();
 
  630     const SerialDenseMatrix<int,Scalar> & AHat = explicitTableau_->A();
 
  631     const SerialDenseVector<int,Scalar> & bHat = explicitTableau_->b();
 
  632     const SerialDenseVector<int,Scalar> & cHat = explicitTableau_->c();
 
  633     const SerialDenseMatrix<int,Scalar> & A    = implicitTableau_->A();
 
  634     const SerialDenseVector<int,Scalar> & b    = implicitTableau_->b();
 
  635     const SerialDenseVector<int,Scalar> & c    = implicitTableau_->c();
 
  638      wrapperModelPairIMEX =
 
  640        (this->wrapperModel_);
 
  644     Thyra::assign(workingState->getX().ptr(), *(currentState->getX()));
 
  645     RCP<Thyra::VectorBase<Scalar> > stageY =
 
  646       wrapperModelPairIMEX->getExplicitOnlyVector(workingState->getX());
 
  647     RCP<Thyra::VectorBase<Scalar> > stageX =
 
  648       wrapperModelPairIMEX->getIMEXVector(workingState->getX());
 
  650     RCP<StepperIMEX_RK_Partition<Scalar> > thisStepper = Teuchos::rcpFromRef(*
this);
 
  651     this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  655     for (
int i = 0; i < numStages; ++i) {
 
  656       this->setStageNumber(i);
 
  658       Thyra::assign(stageY.ptr(),
 
  659         *(wrapperModelPairIMEX->getExplicitOnlyVector(currentState->getX())));
 
  660       Thyra::assign(xTilde_.ptr(),
 
  661         *(wrapperModelPairIMEX->getIMEXVector(currentState->getX())));
 
  662       for (
int j = 0; j < i; ++j) {
 
  664           RCP<Thyra::VectorBase<Scalar> > stageFy =
 
  665             wrapperModelPairIMEX->getExplicitOnlyVector(stageF_[j]);
 
  666           RCP<Thyra::VectorBase<Scalar> > stageFx =
 
  667             wrapperModelPairIMEX->getIMEXVector(stageF_[j]);
 
  668           Thyra::Vp_StV(stageY.ptr(),  -dt*AHat(i,j), *stageFy);
 
  669           Thyra::Vp_StV(xTilde_.ptr(), -dt*AHat(i,j), *stageFx);
 
  672           Thyra::Vp_StV(xTilde_.ptr(), -dt*A   (i,j), *(stageGx_[j]));
 
  675       this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  678       Scalar ts    = time + c(i)*dt;
 
  679       Scalar tHats = time + cHat(i)*dt;
 
  682         bool isNeeded = 
false;
 
  683         for (
int k=i+1; k<numStages; ++k) 
if (A(k,i) != 0.0) isNeeded = 
true;
 
  684         if (b(i) != 0.0) isNeeded = 
true;
 
  685         if (isNeeded == 
false) {
 
  689           Thyra::assign(stageX.ptr(), *xTilde_);
 
  690           evalImplicitModelExplicitly(stageX, stageY, ts, dt, i, stageGx_[i]);
 
  694         const Scalar alpha = Scalar(1.0)/(dt*A(i,i));
 
  695         const Scalar beta  = Scalar(1.0);
 
  698         RCP<TimeDerivative<Scalar> > timeDer =
 
  700             alpha, xTilde_.getConst()));
 
  706         wrapperModelPairIMEX->setUseImplicitModel(
true);
 
  707         MEB::InArgs<Scalar>  inArgs  = wrapperModelPairIMEX->createInArgs();
 
  708         MEB::OutArgs<Scalar> outArgs = wrapperModelPairIMEX->createOutArgs();
 
  709         inArgs.set_x(stageX);
 
  710         if (wrapperModelPairIMEX->getParameterIndex() >= 0)
 
  711           inArgs.set_p(wrapperModelPairIMEX->getParameterIndex(), stageY);
 
  712         if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(stageGx_[i]);
 
  713         if (inArgs.supports(MEB::IN_ARG_t        )) inArgs.set_t        (ts);
 
  714         if (inArgs.supports(MEB::IN_ARG_step_size)) inArgs.set_step_size(dt);
 
  715         if (inArgs.supports(MEB::IN_ARG_alpha    )) inArgs.set_alpha    (alpha);
 
  716         if (inArgs.supports(MEB::IN_ARG_beta     )) inArgs.set_beta     (beta);
 
  717         if (inArgs.supports(MEB::IN_ARG_stage_number))
 
  718           inArgs.set_stage_number(i);
 
  720         wrapperModelPairIMEX->setForSolve(timeDer, inArgs, outArgs);
 
  722         this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  725         this->solver_->setModel(wrapperModelPairIMEX);
 
  726         sStatus = this->solveImplicitODE(stageX);
 
  729         wrapperModelPairIMEX->setUseImplicitModel(
false);
 
  731         this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  735         Thyra::V_StVpStV(stageGx_[i].ptr(), -alpha, *stageX, alpha, *xTilde_);
 
  738       this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  740       evalExplicitModel(workingState->getX(), tHats, dt, i, stageF_[i]);
 
  741       this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  747     Thyra::assign((workingState->getX()).ptr(), *(currentState->getX()));
 
  748     RCP<Thyra::VectorBase<Scalar> > Z = workingState->getX();
 
  749     RCP<Thyra::VectorBase<Scalar> > X = wrapperModelPairIMEX->getIMEXVector(Z);
 
  750     for (
int i=0; i < numStages; ++i) {
 
  752         Thyra::Vp_StV(Z.ptr(), -dt*bHat(i), *(stageF_[i]));
 
  754         Thyra::Vp_StV(X.ptr(), -dt*b   (i), *(stageGx_[i]));
 
  757     if (pass == 
true) workingState->setSolutionStatus(
Status::PASSED);
 
  759     workingState->setOrder(this->getOrder());
 
  760     workingState->computeNorms(currentState);
 
  761     this->stepperRKAppAction_->execute(solutionHistory, thisStepper,
 
  765   this->setStageNumber(-1);
 
  775 template<
class Scalar>
 
  786 template<
class Scalar>
 
  795   out << 
"--- StepperIMEX_RK_Partition ---\n";
 
  796   out << 
"  explicitTableau_   = " << explicitTableau_ << std::endl;
 
  798    explicitTableau_->describe(out, verbLevel);
 
  799   out << 
"  implicitTableau_   = " << implicitTableau_ << std::endl;
 
  801    implicitTableau_->describe(out, verbLevel);
 
  802   out << 
"  xTilde_            = " << xTilde_  << std::endl;
 
  803   out << 
"  stageF_.size()     = " << stageF_.size() << std::endl;
 
  804   int numStages = stageF_.size();
 
  805   for (
int i=0; i<numStages; ++i)
 
  806     out << 
"    stageF_["<<i<<
"] = " << stageF_[i] << std::endl;
 
  807   out << 
"  stageGx_.size()    = " << stageGx_.size() << std::endl;
 
  808   numStages = stageGx_.size();
 
  809   for (
int i=0; i<numStages; ++i)
 
  810     out << 
"    stageGx_["<<i<<
"] = " << stageGx_[i] << std::endl;
 
  811   out << 
"  stepperRKAppAction_= " << this->stepperRKAppAction_ << std::endl;
 
  812   out << 
"  order_             = " << order_ << std::endl;
 
  813   out << 
"--------------------------------" << std::endl;
 
  817 template<
class Scalar>
 
  820   bool isValidSetup = 
true;
 
  826       this->wrapperModel_);
 
  828   if ( wrapperModelPairIMEX->getExplicitModel() == Teuchos::null) {
 
  829     isValidSetup = 
false;
 
  830     out << 
"The explicit ModelEvaluator is not set!\n";
 
  833   if ( wrapperModelPairIMEX->getImplicitModel() == Teuchos::null) {
 
  834     isValidSetup = 
false;
 
  835     out << 
"The implicit ModelEvaluator is not set!\n";
 
  838   if (this->wrapperModel_ == Teuchos::null) {
 
  839     isValidSetup = 
false;
 
  840     out << 
"The wrapper ModelEvaluator is not set!\n";
 
  843   if (this->solver_ == Teuchos::null) {
 
  844     isValidSetup = 
false;
 
  845     out << 
"The solver is not set!\n";
 
  848   if (this->stepperRKAppAction_ == Teuchos::null) {
 
  849     isValidSetup = 
false;
 
  850     out << 
"The AppAction is not set!\n";
 
  853   if ( explicitTableau_ == Teuchos::null ) {
 
  854     isValidSetup = 
false;
 
  855     out << 
"The explicit tableau is not set!\n";
 
  858   if ( implicitTableau_ == Teuchos::null ) {
 
  859     isValidSetup = 
false;
 
  860     out << 
"The implicit tableau is not set!\n";
 
  867 template<
class Scalar>
 
  871   auto pl = this->getValidParametersBasicImplicit();
 
  872   pl->template set<int>(
"overall order", this->getOrder());
 
  875   explicitStepper->setTableau(
 
  876     explicitTableau_->A(), explicitTableau_->b(), explicitTableau_->c(),
 
  877     explicitTableau_->order(), explicitTableau_->orderMin(),
 
  878     explicitTableau_->orderMax(), explicitTableau_->bstar() );
 
  879   pl->set(
"IMEX-RK Explicit Stepper", *explicitStepper->getValidParameters());
 
  882   implicitStepper->setTableau(
 
  883     implicitTableau_->A(), implicitTableau_->b(), implicitTableau_->c(),
 
  884     implicitTableau_->order(), implicitTableau_->orderMin(),
 
  885     implicitTableau_->orderMax(), implicitTableau_->bstar() );
 
  886   pl->set(
"IMEX-RK Implicit Stepper", *implicitStepper->getValidParameters());
 
  894 template<
class Scalar>
 
  898   std::string stepperType,
 
  902   stepper->setStepperImplicitValues(pl);
 
  903   stepper->setTableausPartition(pl, stepperType);
 
  905   if (model != Teuchos::null) {
 
  906     stepper->setModel(model);
 
  907     stepper->initialize();
 
  915 #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. 
 
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...
 
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)
 
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 describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const 
 
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.