diff --git a/packages/tempus/src/Tempus_SolutionState_impl.hpp b/packages/tempus/src/Tempus_SolutionState_impl.hpp index 40a67bf0f9fb..bc5472a9940f 100644 --- a/packages/tempus/src/Tempus_SolutionState_impl.hpp +++ b/packages/tempus/src/Tempus_SolutionState_impl.hpp @@ -474,7 +474,6 @@ Teuchos::RCP > createSolutionStateX( const Teuchos::RCP >& xdot, const Teuchos::RCP >& xdotdot) { - std::cout << "Called non-const createSolutionStateX" << std::endl; Teuchos::RCP > metaData_nc = Teuchos::rcp(new SolutionStateMetaData()); @@ -496,7 +495,6 @@ Teuchos::RCP > createSolutionStateX( const Teuchos::RCP >& xdot, const Teuchos::RCP >& xdotdot) { - std::cout << "Called const createSolutionStateX" << std::endl; Teuchos::RCP > metaData = Teuchos::rcp(new SolutionStateMetaData()); diff --git a/packages/tempus/src/Tempus_StepperDIRK_decl.hpp b/packages/tempus/src/Tempus_StepperDIRK_decl.hpp index c7625b5d18dd..588d26638213 100644 --- a/packages/tempus/src/Tempus_StepperDIRK_decl.hpp +++ b/packages/tempus/src/Tempus_StepperDIRK_decl.hpp @@ -92,11 +92,11 @@ namespace Tempus { * \State $\dot{X}_i \leftarrow \bar{f}(\tilde{X},t_{n-1}+c_i\Delta t)$ * \EndIf * \Else \Comment{Implicit stage.} + * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_SOLVE)} * \If {``Zero initial guess.''} * \State $X \leftarrow 0$ * \Comment{Else use previous stage value as initial guess.} * \EndIf - * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_SOLVE)} * \State Solve $\mathcal{F}_i( * \dot{X}_i = \frac{X - \tilde{X}}{a_{ii} \Delta t}, * X, t_{n-1}+c_{i}\Delta t) = 0$ for $X$ diff --git a/packages/tempus/src/Tempus_StepperDIRK_impl.hpp b/packages/tempus/src/Tempus_StepperDIRK_impl.hpp index 235da21d2ca1..ea9fc9bbcfd8 100644 --- a/packages/tempus/src/Tempus_StepperDIRK_impl.hpp +++ b/packages/tempus/src/Tempus_StepperDIRK_impl.hpp @@ -12,7 +12,6 @@ #include "Tempus_config.hpp" #include "Tempus_StepperFactory.hpp" #include "Tempus_WrapperModelEvaluatorBasic.hpp" -#include "Tempus_StepperRKModifierDefault.hpp" #include "Teuchos_VerboseObjectParameterListHelpers.hpp" #include "Thyra_VectorStdOps.hpp" #include "NOX_Thyra.H" @@ -96,7 +95,7 @@ void StepperDIRK::setup( stepperObserver_ = Teuchos::rcp(new StepperRKObserverComposite()); this->setObserver(Teuchos::null); #endif - this->setAppAction(Teuchos::null); + this->setAppAction(stepperRKAppAction); this->setSolver(solver); if (appModel != Teuchos::null) { diff --git a/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp b/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp index 7ba0fe42fd11..58c5c832290d 100644 --- a/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp +++ b/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp @@ -57,7 +57,7 @@ namespace Tempus { * * \f{algorithm}{ * \renewcommand{\thealgorithm}{} - * \caption{Explcit RK with the application-action locations indicated.} + * \caption{Explicit RK with the application-action locations indicated.} * \begin{algorithmic}[1] * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)} * \State $X \leftarrow x_{n-1}$ \Comment Set initial guess to last timestep. diff --git a/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp b/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp index 3be4c7897c2d..74294b5d9660 100644 --- a/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp +++ b/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp @@ -10,7 +10,6 @@ #define Tempus_StepperExplicitRK_impl_hpp #include "Tempus_RKButcherTableau.hpp" -#include "Tempus_StepperRKModifierDefault.hpp" #include "Teuchos_VerboseObjectParameterListHelpers.hpp" #include "Thyra_VectorStdOps.hpp" diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp index 4710690ea0b9..8a9b1c2e8c44 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp @@ -14,7 +14,9 @@ #include "Tempus_RKButcherTableau.hpp" #include "Tempus_StepperImplicit.hpp" #include "Tempus_WrapperModelEvaluatorPairPartIMEX_Basic.hpp" -#include "Tempus_StepperRKObserverComposite.hpp" +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + #include "Tempus_StepperRKObserverComposite.hpp" +#endif namespace Tempus { @@ -214,25 +216,91 @@ namespace Tempus { * * Partitioned IMEX-RK Algorithm * The single-timestep algorithm for the partitioned IMEX-RK is - * - \f$Z_1 \leftarrow z_{n-1}\f$ (Recall \f$Z_i = \{Y_i,X_i\}^T\f$) - * - for \f$i = 1 \ldots s\f$ do - * - \f$Y_i = y_{n-1} -\Delta t \sum_{j=1}^{i-1} \hat{a}_{ij}\;f^y_j\f$ - * - \f$\tilde{X} \leftarrow x_{n-1} - \Delta t\,\sum_{j=1}^{i-1} \left[ - * \hat{a}_{ij}\, f^x_j + a_{ij}\, g^x_j \right] \f$ - * - if \f$a_{ii} = 0\f$ - * - \f$X_i \leftarrow \tilde{X}\f$ - * - \f$g^x_i \leftarrow g^x(X_i,Y_i,t_i)\f$ - * - else - * - Solve \f$\mathcal{G}^x( - * \tilde{\dot{X}} = \frac{X_i-\tilde{X}}{a_{ii} \Delta t}, - * X_i,Y_i,t_i) = 0\f$ - * for \f$X_i\f$ where \f$Y_i\f$ are known parameters - * - \f$g^x_i \leftarrow - \tilde{\dot{X}}\f$ - * - \f$f_i \leftarrow f(Z_i,\hat{t}_i)\f$ - * - \f$\dot{Z} \leftarrow - g(Z_i,t_i) - f(Z_i,t_i)\f$ [Optionally] - * - end for - * - \f$z_n = z_{n-1} - \Delta t\,\sum_{i=1}^{s}\hat{b}_i\, f_i\f$ - * - \f$x_n \mathrel{+{=}} - \Delta t\,\sum_{i=1}^{s} b_i\, g^x_i\f$ + * \f{algorithm}{ + * \renewcommand{\thealgorithm}{} + * \caption{IMEX RK with the application-action locations indicated.} + * \begin{algorithmic}[1] + * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)} + * \State $Z \leftarrow z_{n-1}$ (Recall $Z_i = \{Y_i,X_i\}^T$) + * \Comment Set initial guess to last timestep. + * \For {$i = 0 \ldots s-1$} + * \State $Y_i = y_{n-1} -\Delta t \sum_{j=1}^{i-1} \hat{a}_{ij}\;f^y_j$ + * \State $\tilde{X} \leftarrow x_{n-1} - \Delta t\,\sum_{j=1}^{i-1} \left[ + * \hat{a}_{ij}\, f^x_j + a_{ij}\, g^x_j \right]$ + * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STAGE)} + * \State \Comment Implicit Tableau + * \If {$a_{ii} = 0$} + * \State $X_i \leftarrow \tilde{X}$ + * \If {$a_{k,i} = 0 \;\forall k = (i+1,\ldots, s-1)$, $b(i) = 0$, $b^\ast(i) = 0$} + * \State $g^x_i \leftarrow 0$ \Comment{Not needed for later calculations.} + * \Else + * \State $g^x_i \leftarrow g^x(X_i,Y_i,t_i)$ + * \EndIf + * \Else + * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_SOLVE)} + * \If {``Zero initial guess.''} + * \State $X \leftarrow 0$ + * \Comment{Else use previous stage value as initial guess.} + * \EndIf + * \State Solve $\mathcal{G}^x\left(\tilde{\dot{X}} + * = \frac{X-\tilde{X}}{a_{ii} \Delta t},X,Y,t_i\right) = 0$ + * for $X$ where $Y$ are known parameters + * \State {\it appAction.execute(solutionHistory, stepper, AFTER\_SOLVE)} + * \State $\tilde{\dot{X}} \leftarrow \frac{X - \tilde{X}}{a_{ii} \Delta t}$ + * \State $g_i \leftarrow - \tilde{\dot{X}}$ + * \EndIf + * \State \Comment Explicit Tableau + * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_EXPLICIT\_EVAL)} + * \State $f_i \leftarrow M(X,\hat{t}_i)^{-1}\, F(X,\hat{t}_i)$ + * \State $\dot{Z} \leftarrow - g(Z_i,t_i) - f(Z_i,t_i)$ [Optionally] + * \State {\it appAction.execute(solutionHistory, stepper, END\_STAGE)} + * \EndFor + * \State $z_n = z_{n-1} - \Delta t\,\sum_{i=1}^{s}\hat{b}_i\, f_i$ + * \State $x_n \mathrel{+{=}} - \Delta t\,\sum_{i=1}^{s} b_i\, g^x_i$ + * \State {\it appAction.execute(solutionHistory, stepper, END\_STEP)} + * \end{algorithmic} + * \f} + * + * The following table contains the pre-coded IMEX-RK tableaus. + * + * + *
Partitioned IMEX-RK Tableaus
Name Order Implicit Tableau Explicit Tableau + *
Partitioned IMEX RK 1st order 1st + * \f[ \begin{array}{c|cc} + * 0 & 0 & 0 \\ + * 1 & 0 & 1 \\ \hline + * & 0 & 1 + * \end{array} \f] + * \f[ \begin{array}{c|cc} + * 0 & 0 & 0 \\ + * 1 & 1 & 0 \\ \hline + * & 1 & 0 + * \end{array} \f] + *
Partitioned IMEX RK SSP2\n \f$\gamma = 1-1/\sqrt{2}\f$ 2nd + * \f[ \begin{array}{c|cc} + * \gamma & \gamma & 0 \\ + * 1-\gamma & 1-2\gamma & \gamma \\ \hline + * & 1/2 & 1/2 + * \end{array} \f] + * \f[ \begin{array}{c|cc} + * 0 & 0 & 0 \\ + * 1 & 1 & 0 \\ \hline + * & 1/2 & 1/2 + * \end{array} \f] + *
Partitioned IMEX RK ARS 233\n \f$\gamma = (3+\sqrt{3})/6\f$ 3rd + * \f[ \begin{array}{c|ccc} + * 0 & 0 & 0 & 0 \\ + * \gamma & 0 & \gamma & 0 \\ + * 1-\gamma & 0 & 1-2\gamma & \gamma \\ \hline + * & 0 & 1/2 & 1/2 + * \end{array} \f] + * \f[ \begin{array}{c|ccc} + * 0 & 0 & 0 & 0 \\ + * \gamma & \gamma & 0 & 0 \\ + * 1-\gamma & \gamma-1 & 2-2\gamma & 0 \\ \hline + * & 0 & 1/2 & 1/2 + * \end{array} \f] + *
* * The First-Step-As-Last (FSAL) principle is not valid for IMEX RK Partition. * The default is to set useFSAL=false, and useFSAL=true will result @@ -258,7 +326,8 @@ class StepperIMEX_RK_Partition : virtual public Tempus::StepperImplicit, */ StepperIMEX_RK_Partition(); - /// Constructor to specialize Stepper parameters. + /// Constructor to for all member data. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE StepperIMEX_RK_Partition( const Teuchos::RCP >& appModel, const Teuchos::RCP >& obs, @@ -271,6 +340,19 @@ class StepperIMEX_RK_Partition : virtual public Tempus::StepperImplicit, Teuchos::RCP > explicitTableau, Teuchos::RCP > implicitTableau, Scalar order); +#endif + StepperIMEX_RK_Partition( + const Teuchos::RCP >& appModel, + const Teuchos::RCP >& solver, + bool useFSAL, + std::string ICConsistency, + bool ICConsistencyCheck, + bool zeroInitialGuess, + const Teuchos::RCP >& stepperRKAppAction, + std::string stepperType, + Teuchos::RCP > explicitTableau, + Teuchos::RCP > implicitTableau, + Scalar order); /// \name Basic stepper methods //@{ @@ -301,11 +383,13 @@ class StepperIMEX_RK_Partition : virtual public Tempus::StepperImplicit, const Teuchos::RCP >& explicitModel, const Teuchos::RCP >& implicitModel); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE virtual void setObserver( Teuchos::RCP > obs = Teuchos::null); virtual Teuchos::RCP > getObserver() const { return this->stepperObserver_; } +#endif /// Initialize during construction and after changing input parameters. virtual void initialize(); @@ -383,7 +467,9 @@ class StepperIMEX_RK_Partition : virtual public Tempus::StepperImplicit, Teuchos::RCP > xTilde_; +#ifndef TEMPUS_HIDE_DEPRECATED_CODE Teuchos::RCP > stepperObserver_; +#endif }; diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp index 155d7b86b88b..91abba4094b8 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_impl.hpp @@ -35,11 +35,15 @@ StepperIMEX_RK_Partition::StepperIMEX_RK_Partition() this->setStageNumber(-1); this->setTableaus("Partitioned IMEX RK SSP2"); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->setObserver(); +#endif + this->setAppAction(Teuchos::null); this->setDefaultSolver(); } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE template StepperIMEX_RK_Partition::StepperIMEX_RK_Partition( const Teuchos::RCP >& appModel, @@ -65,6 +69,44 @@ StepperIMEX_RK_Partition::StepperIMEX_RK_Partition( this->setExplicitTableau(explicitTableau); this->setImplicitTableau(implicitTableau); this->setObserver(obs); + this->setAppAction(Teuchos::null); + this->setSolver(solver); + + if (appModel != Teuchos::null) { + this->setModel(appModel); + this->initialize(); + } +} +#endif +template +StepperIMEX_RK_Partition::StepperIMEX_RK_Partition( + const Teuchos::RCP >& appModel, + const Teuchos::RCP >& solver, + bool useFSAL, + std::string ICConsistency, + bool ICConsistencyCheck, + bool zeroInitialGuess, + const Teuchos::RCP >& stepperRKAppAction, + std::string stepperType, + Teuchos::RCP > explicitTableau, + Teuchos::RCP > implicitTableau, + Scalar order) +{ + this->setStepperType( stepperType); + this->setUseFSAL( useFSAL); + this->setICConsistency( ICConsistency); + this->setICConsistencyCheck( ICConsistencyCheck); + this->setZeroInitialGuess( zeroInitialGuess); + this->setOrder( order); + + this->setStageNumber(-1); + + this->setExplicitTableau(explicitTableau); + this->setImplicitTableau(implicitTableau); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + this->setObserver(Teuchos::null); +#endif + this->setAppAction(stepperRKAppAction); this->setSolver(solver); if (appModel != Teuchos::null) { @@ -340,6 +382,7 @@ void StepperIMEX_RK_Partition::setModelPair( } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE template void StepperIMEX_RK_Partition::setObserver( Teuchos::RCP > obs) @@ -368,6 +411,7 @@ void StepperIMEX_RK_Partition::setObserver( this->isInitialized_ = false; } +#endif template @@ -542,7 +586,13 @@ void StepperIMEX_RK_Partition::takeStep( "Try setting in \"Solution History\" \"Storage Type\" = \"Undo\"\n" " or \"Storage Type\" = \"Static\" and \"Storage Limit\" = \"2\"\n"); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeginTakeStep(solutionHistory, *this); +#endif + RCP > thisStepper = Teuchos::rcpFromRef(*this); + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEGIN_STEP); + RCP > currentState=solutionHistory->getCurrentState(); RCP > workingState=solutionHistory->getWorkingState(); const Scalar dt = workingState->getTimeStep(); @@ -573,7 +623,9 @@ void StepperIMEX_RK_Partition::takeStep( // Compute stage solutions for (int i = 0; i < numStages; ++i) { this->setStageNumber(i); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeginStage(solutionHistory, *this); +#endif Thyra::assign(stageY.ptr(), *(wrapperModelPairIMEX->getExplicitOnlyVector(currentState->getX()))); @@ -592,6 +644,9 @@ void StepperIMEX_RK_Partition::takeStep( Thyra::Vp_StV(xTilde_.ptr(), -dt*A (i,j), *(stageGx_[j])); } + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEGIN_STAGE); + Scalar ts = time + c(i)*dt; Scalar tHats = time + cHat(i)*dt; if (A(i,i) == Teuchos::ScalarTraits::zero()) { @@ -604,7 +659,9 @@ void StepperIMEX_RK_Partition::takeStep( assign(stageGx_[i].ptr(), Teuchos::ScalarTraits::zero()); } else { Thyra::assign(stageX.ptr(), *xTilde_); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeforeImplicitExplicitly(solutionHistory, *this); +#endif evalImplicitModelExplicitly(stageX, stageY, ts, dt, i, stageGx_[i]); } } else { @@ -637,7 +694,11 @@ void StepperIMEX_RK_Partition::takeStep( wrapperModelPairIMEX->setForSolve(timeDer, inArgs, outArgs); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeforeSolve(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEFORE_SOLVE); this->solver_->setModel(wrapperModelPairIMEX); sStatus = this->solveImplicitODE(stageX); @@ -645,15 +706,27 @@ void StepperIMEX_RK_Partition::takeStep( wrapperModelPairIMEX->setUseImplicitModel(false); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeAfterSolve(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::AFTER_SOLVE); // Update contributions to stage values Thyra::V_StVpStV(stageGx_[i].ptr(), -alpha, *stageX, alpha, *xTilde_); } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeforeExplicit(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEFORE_EXPLICIT_EVAL); evalExplicitModel(stageZ_, tHats, dt, i, stageF_[i]); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeEndStage(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::END_STAGE); } // Sum for solution: y_n = y_n-1 - dt*Sum{ bHat(i)*fy(i) } @@ -672,7 +745,11 @@ void StepperIMEX_RK_Partition::takeStep( else workingState->setSolutionStatus(Status::FAILED); workingState->setOrder(this->getOrder()); workingState->computeNorms(currentState); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeEndTakeStep(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::END_STEP); } // reset the stage number this->setStageNumber(-1); @@ -722,7 +799,10 @@ void StepperIMEX_RK_Partition::describe( numStages = stageGx_.size(); for (int i=0; i::isValidSetup(Teuchos::FancyOStream & out) out << "The solver is not set!\n"; } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE if (stepperObserver_ == Teuchos::null) { isValidSetup = false; out << "The stepper observer is not set!\n"; } +#endif + if (this->stepperRKAppAction_ == Teuchos::null) { + isValidSetup = false; + out << "The AppAction is not set!\n"; + } if ( explicitTableau_ == Teuchos::null ) { isValidSetup = false; diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp index 4ab168d4284d..2ac4c7c64200 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp @@ -14,7 +14,9 @@ #include "Tempus_RKButcherTableau.hpp" #include "Tempus_StepperImplicit.hpp" #include "Tempus_WrapperModelEvaluatorPairIMEX_Basic.hpp" -#include "Tempus_StepperRKObserverComposite.hpp" +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + #include "Tempus_StepperRKObserverComposite.hpp" +#endif namespace Tempus { @@ -149,23 +151,48 @@ namespace Tempus { * IMEX-RK Algorithm * * The single-timestep algorithm for IMEX-RK is - * - \f$X_1 \leftarrow x_{n-1}\f$ - * - for \f$i = 1 \ldots s\f$ do - * - \f$\tilde{X} \leftarrow x_{n-1} - \Delta t\,\sum_{j=1}^{i-1} \left( - * \hat{a}_{ij}\, f(X_j,\hat{t}_j) + a_{ij}\, g(X_j,t_j) \right) \f$ - * - if \f$a_{ii} = 0\f$ - * - \f$X_i \leftarrow \tilde{X}\f$ - * - \f$g(X_i,t_i) \leftarrow M(X_i, t_i)^{-1}\, G(X_i, t_i)\f$ - * - else - * - Solve \f$\mathcal{G}\left(\tilde{\dot{X}} - * = \frac{X_i-\tilde{X}}{a_{ii} \Delta t},X_i,t_i\right) = 0\f$ - * for \f$X_i\f$ - * - \f$g(X_i,t_i) \leftarrow - \tilde{\dot{X}}\f$ - * - \f$f(X_i,\hat{t}_i) \leftarrow M(X_i,\hat{t}_i)^{-1}\, F(X_i,\hat{t}_i)\f$ - * - \f$\dot{X}_i(X_i,t_i) \leftarrow - g(X_i,t_i) - f(X_i,t_i)\f$ [Optionally] - * - end for - * - \f$x_n \leftarrow x_{n-1} - \Delta t\,\sum_{i=1}^{s}\hat{b}_i\,f(X_i,\hat{t}_i) - * - \Delta t\,\sum_{i=1}^{s} b_i\,g(X_i,t_i)\f$ + * + * \f{algorithm}{ + * \renewcommand{\thealgorithm}{} + * \caption{IMEX RK with the application-action locations indicated.} + * \begin{algorithmic}[1] + * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)} + * \State $X \leftarrow x_{n-1}$ \Comment Set initial guess to last timestep. + * \For {$i = 0 \ldots s-1$} + * \State $\tilde{X} \leftarrow x_{n-1} - \Delta t\,\sum_{j=1}^{i-1} \left( + * \hat{a}_{ij}\, f_j + a_{ij}\, g_j \right)$ + * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STAGE)} + * \State \Comment Implicit Tableau + * \If {$a_{ii} = 0$} + * \State $X \leftarrow \tilde{X}$ + * \If {$a_{k,i} = 0 \;\forall k = (i+1,\ldots, s-1)$, $b(i) = 0$, $b^\ast(i) = 0$} + * \State $g_i \leftarrow 0$ \Comment{Not needed for later calculations.} + * \Else + * \State $g_i \leftarrow M(X, t_i)^{-1}\, G(X, t_i)$ + * \EndIf + * \Else + * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_SOLVE)} + * \If {``Zero initial guess.''} + * \State $X \leftarrow 0$ + * \Comment{Else use previous stage value as initial guess.} + * \EndIf + * \State Solve $\mathcal{G}\left(\tilde{\dot{X}} + * = \frac{X-\tilde{X}}{a_{ii} \Delta t},X,t_i\right) = 0$ for $X$ + * \State {\it appAction.execute(solutionHistory, stepper, AFTER\_SOLVE)} + * \State $\tilde{\dot{X}} \leftarrow \frac{X - \tilde{X}}{a_{ii} \Delta t}$ + * \State $g_i \leftarrow - \tilde{\dot{X}}$ + * \EndIf + * \State \Comment Explicit Tableau + * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_EXPLICIT\_EVAL)} + * \State $f_i \leftarrow M(X,\hat{t}_i)^{-1}\, F(X,\hat{t}_i)$ + * \State $\dot{X} \leftarrow - g_i - f_i$ [Optionally] + * \State {\it appAction.execute(solutionHistory, stepper, END\_STAGE)} + * \EndFor + * \State $x_n \leftarrow x_{n-1} - \Delta t\,\sum_{i=1}^{s}\hat{b}_i\,f_i + * - \Delta t\,\sum_{i=1}^{s} b_i \,g_i$ + * \State {\it appAction.execute(solutionHistory, stepper, END\_STEP)} + * \end{algorithmic} + * \f} * * The following table contains the pre-coded IMEX-RK tableaus. * @@ -182,7 +209,16 @@ namespace Tempus { * 1 & 1 & 0 \\ \hline * & 1 & 0 * \end{array} \f] - *
IMEX RK SSP2\n \f$\gamma = 1-1/\sqrt{2}\f$ 2nd + *
SSP1_111 1st + * \f[ \begin{array}{c|c} + * 1 & 1 \\ \hline + * & 1 + * \end{array} \f] + * \f[ \begin{array}{c|c} + * 0 & 0 \\ \hline + * & 1 + * \end{array} \f] + *
IMEX RK SSP2\n SSP2_222_L\n \f$\gamma = 1-1/\sqrt{2}\f$ 2nd * \f[ \begin{array}{c|cc} * \gamma & \gamma & 0 \\ * 1-\gamma & 1-2\gamma & \gamma \\ \hline @@ -193,7 +229,29 @@ namespace Tempus { * 1 & 1 & 0 \\ \hline * & 1/2 & 1/2 * \end{array} \f] - *
IMEX RK ARS 233\n \f$\gamma = (3+\sqrt{3})/6\f$ 3rd + *
SSP2_222\n SSP2_222_A\n \f$\gamma = 1/2\f$ 2nd + * \f[ \begin{array}{c|cc} + * \gamma & \gamma & 0 \\ + * 1-\gamma & 1-2\gamma & \gamma \\ \hline + * & 1/2 & 1/2 + * \end{array} \f] + * \f[ \begin{array}{c|cc} + * 0 & 0 & 0 \\ + * 1 & 1 & 0 \\ \hline + * & 1/2 & 1/2 + * \end{array} \f] + *
IMEX RK SSP3\n SSP3_332\n \f$\gamma = 1/ (2 + \sqrt{2})\f$ 3rd + * \f[ \begin{array}{c|ccc} + * 0 & 0 & & \\ + * 1 & 1 & 0 & \\ + * 1/2 & 1/4 & 1/4 & 0 \\ \hline + * & 1/6 & 1/6 & 4/6 \end{array} \f] + * \f[ \begin{array}{c|ccc} + * \gamma & \gamma & & \\ + * 1-\gamma & 1-2\gamma & \gamma & \\ + * 1-2 & 1/2 -\gamma & 0 & \gamma \\ \hline + * & 1/6 & 1/6 & 2/3 \end{array} \f] + *
IMEX RK ARS 233\n ARS 233\n \f$\gamma = (3+\sqrt{3})/6\f$ 3rd * \f[ \begin{array}{c|ccc} * 0 & 0 & 0 & 0 \\ * \gamma & 0 & \gamma & 0 \\ @@ -222,6 +280,7 @@ namespace Tempus { * Chuadhry, Hensinger, Fischer, Robinson, Rider, Niederhaus, Sanchez, * "Towards an IMEX Monolithic ALE Method with Integrated UQ for * Multiphysics Shock-hydro", SAND2016-11353, 2016, pp. 21-28. + * */ template class StepperIMEX_RK : virtual public Tempus::StepperImplicit, @@ -236,7 +295,8 @@ class StepperIMEX_RK : virtual public Tempus::StepperImplicit, */ StepperIMEX_RK(); - /// Constructor to specialize Stepper parameters. + /// Constructor for all member data. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE StepperIMEX_RK( const Teuchos::RCP >& appModel, const Teuchos::RCP >& obs, @@ -249,6 +309,20 @@ class StepperIMEX_RK : virtual public Tempus::StepperImplicit, Teuchos::RCP > explicitTableau, Teuchos::RCP > implicitTableau, Scalar order); +#endif + StepperIMEX_RK( + const Teuchos::RCP >& appModel, + const Teuchos::RCP >& solver, + bool useFSAL, + std::string ICConsistency, + bool ICConsistencyCheck, + bool zeroInitialGuess, + const Teuchos::RCP >& stepperRKAppAction, + std::string stepperType, + Teuchos::RCP > explicitTableau, + Teuchos::RCP > implicitTableau, + Scalar order); + /// \name Basic stepper methods //@{ @@ -278,12 +352,13 @@ class StepperIMEX_RK : virtual public Tempus::StepperImplicit, const Teuchos::RCP >& explicitModel, const Teuchos::RCP >& implicitModel); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE virtual void setObserver( Teuchos::RCP > obs = Teuchos::null); virtual Teuchos::RCP > getObserver() const { return this->stepperObserver_; } - +#endif /// Initialize during construction and after changing input parameters. virtual void initialize(); @@ -359,7 +434,9 @@ class StepperIMEX_RK : virtual public Tempus::StepperImplicit, Teuchos::RCP > xTilde_; +#ifndef TEMPUS_HIDE_DEPRECATED_CODE Teuchos::RCP > stepperObserver_; +#endif }; diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp index 99ac346075e0..cd3a4d0c58ec 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_impl.hpp @@ -35,11 +35,15 @@ StepperIMEX_RK::StepperIMEX_RK() this->setStageNumber(-1); this->setTableaus("IMEX RK SSP2"); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->setObserver(); +#endif + this->setAppAction(Teuchos::null); this->setDefaultSolver(); } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE template StepperIMEX_RK::StepperIMEX_RK( const Teuchos::RCP >& appModel, @@ -66,6 +70,44 @@ StepperIMEX_RK::StepperIMEX_RK( this->setImplicitTableau(implicitTableau); this->setOrder(order); this->setObserver(obs); + this->setAppAction(Teuchos::null); + this->setSolver(solver); + + if (appModel != Teuchos::null) { + this->setModel(appModel); + this->initialize(); + } +} +#endif +template +StepperIMEX_RK::StepperIMEX_RK( + const Teuchos::RCP >& appModel, + const Teuchos::RCP >& solver, + bool useFSAL, + std::string ICConsistency, + bool ICConsistencyCheck, + bool zeroInitialGuess, + const Teuchos::RCP >& stepperRKAppAction, + std::string stepperType, + Teuchos::RCP > explicitTableau, + Teuchos::RCP > implicitTableau, + Scalar order) +{ + this->setStepperType( stepperType); + this->setUseFSAL( useFSAL); + this->setICConsistency( ICConsistency); + this->setICConsistencyCheck( ICConsistencyCheck); + this->setZeroInitialGuess( zeroInitialGuess); + + this->setStageNumber(-1); + + this->setExplicitTableau(explicitTableau); + this->setImplicitTableau(implicitTableau); + this->setOrder(order); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + this->setObserver(Teuchos::null); +#endif + this->setAppAction(stepperRKAppAction); this->setSolver(solver); if (appModel != Teuchos::null) { @@ -142,7 +184,7 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, this->setStepperType("IMEX RK 1st order"); this->setOrder(1); - } else if ( stepperType == "SSP1_111" ) + } else if ( stepperType == "SSP1_111" ) { { // Explicit Tableau @@ -156,10 +198,10 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, const Scalar zero = ST::zero(); // Fill A: - A(0,0) = zero; + A(0,0) = zero; // Fill b: - b(0) = one; + b(0) = one; // Fill c: c(0) = zero; @@ -298,11 +340,14 @@ void StepperIMEX_RK::setTableaus(std::string stepperType, TEUCHOS_TEST_FOR_EXCEPTION( true, std::logic_error, "Error - Not a valid StepperIMEX_RK type! Stepper Type = " << stepperType << "\n" - << " Current valid types are: " << "\n" - << " 'IMEX RK 1st order (SSP1_111)'" << "\n" - << " 'IMEX RK SSP2'" << "\n" - << " 'IMEX RK ARS 233'" << "\n" - << " 'General IMEX RK'" << "\n"); + << " Current valid types are: \n" + << " 'IMEX RK 1st order\n" + << " 'SSP1_111\n" + << " 'IMEX RK SSP2' ('SSP2_222_L')\n" + << " 'SSP2_222' ('SSP2_222_A')\n" + << " 'IMEX RK SSP3' ('SSP3_332')\n" + << " 'IMEX RK ARS 233' ('ARS 233')\n" + << " 'General IMEX RK'\n"); } TEUCHOS_TEST_FOR_EXCEPTION(explicitTableau_==Teuchos::null, @@ -429,6 +474,7 @@ void StepperIMEX_RK::setModelPair( } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE template void StepperIMEX_RK::setObserver( Teuchos::RCP > obs) @@ -457,6 +503,7 @@ void StepperIMEX_RK::setObserver( this->isInitialized_ = false; } +#endif template @@ -619,7 +666,13 @@ void StepperIMEX_RK::takeStep( "Try setting in \"Solution History\" \"Storage Type\" = \"Undo\"\n" " or \"Storage Type\" = \"Static\" and \"Storage Limit\" = \"2\"\n"); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeginTakeStep(solutionHistory, *this); +#endif + RCP > thisStepper = Teuchos::rcpFromRef(*this); + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEGIN_STEP); + RCP > currentState=solutionHistory->getCurrentState(); RCP > workingState=solutionHistory->getWorkingState(); const Scalar dt = workingState->getTimeStep(); @@ -640,7 +693,9 @@ void StepperIMEX_RK::takeStep( // Compute stage solutions for (int i = 0; i < numStages; ++i) { this->setStageNumber(i); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeginStage(solutionHistory, *this); +#endif Thyra::assign(xTilde_.ptr(), *(currentState->getX())); for (int j = 0; j < i; ++j) { if (AHat(i,j) != Teuchos::ScalarTraits::zero()) @@ -649,6 +704,9 @@ void StepperIMEX_RK::takeStep( Thyra::Vp_StV(xTilde_.ptr(), -dt*A (i,j), *(stageG_[j])); } + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEGIN_STAGE); + Scalar ts = time + c(i)*dt; Scalar tHats = time + cHat(i)*dt; if (A(i,i) == Teuchos::ScalarTraits::zero()) { @@ -661,7 +719,9 @@ void StepperIMEX_RK::takeStep( assign(stageG_[i].ptr(), Teuchos::ScalarTraits::zero()); } else { Thyra::assign(this->stageX_.ptr(), *xTilde_); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeforeImplicitExplicitly(solutionHistory, *this); +#endif evalImplicitModelExplicitly(this->stageX_, ts, dt, i, stageG_[i]); } } else { @@ -677,22 +737,38 @@ void StepperIMEX_RK::takeStep( auto p = Teuchos::rcp(new ImplicitODEParameters( timeDer, dt, alpha, beta, SOLVE_FOR_X, i)); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeforeSolve(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEFORE_SOLVE); const Thyra::SolveStatus sStatus = this->solveImplicitODE(this->stageX_, stageG_[i], ts, p); if (sStatus.solveStatus != Thyra::SOLVE_STATUS_CONVERGED) pass = false; +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeAfterSolve(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::AFTER_SOLVE); // Update contributions to stage values Thyra::V_StVpStV(stageG_[i].ptr(), -alpha, *this->stageX_, alpha, *xTilde_); } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeBeforeExplicit(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::BEFORE_EXPLICIT_EVAL); evalExplicitModel(this->stageX_, tHats, dt, i, stageF_[i]); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeEndStage(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::END_STAGE); } // Sum for solution: x_n = x_n-1 - dt*Sum{ bHat(i)*f(i) + b(i)*g(i) } @@ -708,7 +784,11 @@ void StepperIMEX_RK::takeStep( else workingState->setSolutionStatus(Status::FAILED); workingState->setOrder(this->getOrder()); workingState->computeNorms(currentState); +#ifndef TEMPUS_HIDE_DEPRECATED_CODE this->stepperObserver_->observeEndTakeStep(solutionHistory, *this); +#endif + this->stepperRKAppAction_->execute(solutionHistory, thisStepper, + StepperRKAppAction::ACTION_LOCATION::END_STEP); } // reset the stage number this->setStageNumber(-1); @@ -758,7 +838,10 @@ void StepperIMEX_RK::describe( numStages = stageG_.size(); for (int i=0; i::isValidSetup(Teuchos::FancyOStream & out) const out << "The wrapper ModelEvaluator is not set!\n"; } +#ifndef TEMPUS_HIDE_DEPRECATED_CODE if (stepperObserver_ == Teuchos::null) { isValidSetup = false; out << "The stepper observer is not set!\n"; } +#endif + if (this->stepperRKAppAction_ == Teuchos::null) { + isValidSetup = false; + out << "The AppAction is not set!\n"; + } if ( explicitTableau_ == Teuchos::null ) { isValidSetup = false; diff --git a/packages/tempus/src/Tempus_StepperRKAppAction.hpp b/packages/tempus/src/Tempus_StepperRKAppAction.hpp index e40692466a41..7b4a4b954d81 100644 --- a/packages/tempus/src/Tempus_StepperRKAppAction.hpp +++ b/packages/tempus/src/Tempus_StepperRKAppAction.hpp @@ -21,63 +21,16 @@ template class StepperRKBase; /** \brief Application Action for StepperRKBase. * - * This class provides a means to apply various actions with the RK time step. - * The data available to this class is solution variables (through - * SolutionHistory), and stepper data (through the Stepper). It allows - * the application to just observe this data (i.e., use but not change the - * data) to change any of it (USER BEWARE!). + * This class provides a means to apply various actions with the + * RK time step. The data available to this class is solution + * variables (through SolutionHistory), and stepper data (through + * the Stepper). It allows the application to just observe this + * data (i.e., use but not change the data) to change any of it + * (USER BEWARE!). * - * Below is the IMEX RK algorithm and includes the locations where the - * application can take actions (in italicized). - * - * \f{algorithm}{ - * \renewcommand{\thealgorithm}{} - * \caption{IMEX RK with the application-action locations indicated.} - * \begin{algorithmic}[1] - * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)} - * \State $X \leftarrow x_{n-1}$ \Comment Set initial guess to last timestep. - * \For {$i = 0 \ldots s-1$} - * \If { $\hat{a}_{k,i} = 0 \;\forall k = (i+1,\ldots, s-1)$, $\hat{b}(i) = 0$, $\hat{b}^\ast(i) = 0$ and \newline \hspace*{0.37in} - * $a_{k,i} = 0 \;\forall k = (i+1,\ldots, s-1)$, $b(i) = 0$, $b^\ast(i) = 0$} - * \State $g_i \leftarrow 0$ \Comment{Not needed for later calculations.} - * \State $f_i \leftarrow 0$ \Comment{Not needed for later calculations.} - * \State {\bf continue} - * \EndIf - * \State $\tilde{X} \leftarrow x_{n-1} - \Delta t\,\sum_{j=1}^{i-1} \left( - * \hat{a}_{ij}\, f_j + a_{ij}\, g_j \right)$ - * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STAGE)} - * \State \Comment Implicit Tableau - * \If {$a_{ii} = 0$} - * \State $X \leftarrow \tilde{X}$ - * \If {$i=0$ and ``Use FSAL''} \Comment{Save an evaluation.} - * \State $g_0 \leftarrow g_{s-1}$ - * \Comment{Use $g_{s-1}$ from $n-1$ time step.} - * \Else - * \State $g_i \leftarrow M(X, t_i)^{-1}\, G(X, t_i)$ - * \EndIf - * \Else - * \If {``Zero initial guess.''} - * \State $X \leftarrow 0$ - * \Comment{Else use previous stage value as initial guess.} - * \EndIf - * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_SOLVE)} - * \State Solve $\mathcal{G}\left(\tilde{\dot{X}} - * = \frac{X-\tilde{X}}{a_{ii} \Delta t},X,t_i\right) = 0$ for $X$ - * \State {\it appAction.execute(solutionHistory, stepper, AFTER\_SOLVE)} - * \State $\tilde{\dot{X}} \leftarrow \frac{X - \tilde{X}}{a_{ii} \Delta t}$ - * \State $g_i \leftarrow - \tilde{\dot{X}}$ - * \EndIf - * \State \Comment Explicit Tableau - * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_EXPLICIT\_EVAL)} - * \State $f_i \leftarrow M(X,\hat{t}_i)^{-1}\, F(X,\hat{t}_i)$ - * \State $\dot{X} \leftarrow - g_i - f_i$ [Optionally] - * \State {\it appAction.execute(solutionHistory, stepper, END\_STAGE)} - * \EndFor - * \State $x_n \leftarrow x_{n-1} - \Delta t\,\sum_{i=1}^{s}\hat{b}_i\,f_i - * - \Delta t\,\sum_{i=1}^{s} b_i \,g_i$ - * \State {\it appAction.execute(solutionHistory, stepper, END\_STEP)} - * \end{algorithmic} - * \f} + * The locations of the RK AppActions (ACITON_LOCATION) in takeStep + * are documented in each of the RK Algorithm sections: + * StepperExplicitRK, StepperDIRK and StepperIMEX_RK. */ template class StepperRKAppAction diff --git a/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp b/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp index cac42814e224..0bd63ec99c41 100644 --- a/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp +++ b/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp @@ -75,7 +75,6 @@ class StepperERK_ForwardEuler : bool ICConsistencyCheck, bool useEmbedded, const Teuchos::RCP >& stepperRKAppAction) - { this->setStepperType("RK Forward Euler"); this->setupTableau(); @@ -2045,6 +2044,8 @@ class StepperSDIRK_2Stage2ndOrder : this->setupTableau(); } + Scalar getGamma() { return gamma_; } + std::string getDescription() const { std::ostringstream Description; @@ -2375,6 +2376,9 @@ class StepperSDIRK_2Stage3rdOrder : this->isInitialized_ = false; this->setupTableau(); } + + std::string getGammaType() { return gammaType_; } + void setGamma(Scalar gamma) { if ( gammaType_ == "gamma" ) { @@ -2384,6 +2388,8 @@ class StepperSDIRK_2Stage3rdOrder : this->isInitialized_ = false; } + Scalar getGamma() { return gamma_; } + std::string getDescription() const { std::ostringstream Description; @@ -2696,6 +2702,8 @@ class StepperDIRK_1StageTheta : this->isInitialized_ = false; } + Scalar getTheta() { return theta_; } + std::string getDescription() const { std::ostringstream Description; @@ -2857,6 +2865,8 @@ class StepperEDIRK_2StageTheta : this->setupTableau(); } + Scalar getTheta() { return theta_; } + std::string getDescription() const { std::ostringstream Description; diff --git a/packages/tempus/test/BDF2/Tempus_BDF2Test.cpp b/packages/tempus/test/BDF2/Tempus_BDF2Test.cpp index 92fb84703c99..0c2756512987 100644 --- a/packages/tempus/test/BDF2/Tempus_BDF2Test.cpp +++ b/packages/tempus/test/BDF2/Tempus_BDF2Test.cpp @@ -34,14 +34,6 @@ #include #include -// Comment out any of the following tests to exclude from build/run. -#define TEST_PARAMETERLIST -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS -#define TEST_SINCOS_ADAPT -#define TEST_CDR -#define TEST_VANDERPOL - namespace Tempus_Test { using Teuchos::RCP; @@ -56,7 +48,6 @@ using Tempus::SolutionHistory; using Tempus::SolutionState; -#ifdef TEST_PARAMETERLIST // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, ParameterList) @@ -106,10 +97,8 @@ TEUCHOS_UNIT_TEST(BDF2, ParameterList) TEST_ASSERT(pass) } } -#endif // TEST_PARAMETERLIST -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, ConstructingFromDefaults) @@ -203,10 +192,8 @@ TEUCHOS_UNIT_TEST(BDF2, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.839732, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.542663, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, SinCos) @@ -328,10 +315,8 @@ TEUCHOS_UNIT_TEST(BDF2, SinCos) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_SINCOS -#ifdef TEST_SINCOS_ADAPT // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, SinCosAdapt) @@ -478,10 +463,8 @@ TEUCHOS_UNIT_TEST(BDF2, SinCosAdapt) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_SINCOS_ADAPT -#ifdef TEST_CDR // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, CDR) @@ -643,10 +626,8 @@ TEUCHOS_UNIT_TEST(BDF2, CDR) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_CDR -#ifdef TEST_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, VanDerPol) @@ -761,6 +742,5 @@ TEUCHOS_UNIT_TEST(BDF2, VanDerPol) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL } // namespace Tempus_Test diff --git a/packages/tempus/test/DIRK/Tempus_DIRKTest.cpp b/packages/tempus/test/DIRK/Tempus_DIRKTest.cpp index 33960e232b38..9e3af0bb855e 100644 --- a/packages/tempus/test/DIRK/Tempus_DIRKTest.cpp +++ b/packages/tempus/test/DIRK/Tempus_DIRKTest.cpp @@ -37,15 +37,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_PARAMETERLIST -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS -#define TEST_VANDERPOL -#define TEST_EMBEDDED_DIRK - -#ifdef TEST_PARAMETERLIST // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(DIRK, ParameterList) @@ -181,10 +173,8 @@ TEUCHOS_UNIT_TEST(DIRK, ParameterList) } } } -#endif // TEST_PARAMETERLIST -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(DIRK, ConstructingFromDefaults) @@ -281,10 +271,8 @@ TEUCHOS_UNIT_TEST(DIRK, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.841470, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.540304, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(DIRK, SinCos) @@ -460,10 +448,8 @@ TEUCHOS_UNIT_TEST(DIRK, SinCos) } } -#endif // TEST_SINCOS -#ifdef TEST_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(DIRK, VanDerPol) @@ -558,10 +544,8 @@ TEUCHOS_UNIT_TEST(DIRK, VanDerPol) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL -#ifdef TEST_EMBEDDED_DIRK // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(DIRK, EmbeddedVanDerPol) @@ -663,7 +647,6 @@ TEUCHOS_UNIT_TEST(DIRK, EmbeddedVanDerPol) Teuchos::TimeMonitor::summarize(); } -#endif } // namespace Tempus_Test diff --git a/packages/tempus/test/ExplicitRK/Tempus_ExplicitRKTest.cpp b/packages/tempus/test/ExplicitRK/Tempus_ExplicitRKTest.cpp index aa0f69556440..0fc77e50c7ee 100644 --- a/packages/tempus/test/ExplicitRK/Tempus_ExplicitRKTest.cpp +++ b/packages/tempus/test/ExplicitRK/Tempus_ExplicitRKTest.cpp @@ -36,15 +36,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_PARAMETERLIST -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS -#define TEST_EMBEDDED_VANDERPOL -#define TEST_STAGE_NUMBER - -#ifdef TEST_PARAMETERLIST // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ExplicitRK, ParameterList) @@ -136,10 +128,8 @@ TEUCHOS_UNIT_TEST(ExplicitRK, ParameterList) } } } -#endif // TEST_PARAMETERLIST -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ExplicitRK, ConstructingFromDefaults) @@ -236,10 +226,8 @@ TEUCHOS_UNIT_TEST(ExplicitRK, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.841470, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.540303, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ExplicitRK, SinCos) @@ -419,10 +407,8 @@ TEUCHOS_UNIT_TEST(ExplicitRK, SinCos) } //Teuchos::TimeMonitor::summarize(); } -#endif // TEST_SINCOS -#ifdef TEST_EMBEDDED_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ExplicitRK, EmbeddedVanDerPol) @@ -535,10 +521,8 @@ TEUCHOS_UNIT_TEST(ExplicitRK, EmbeddedVanDerPol) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_EMBEDDED_VANDERPOL -#ifdef TEST_STAGE_NUMBER // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ExplicitRK, stage_number) @@ -613,6 +597,6 @@ TEUCHOS_UNIT_TEST(ExplicitRK, stage_number) TEST_EQUALITY( stage_number, erk_stepper->getStageNumber()); } } -#endif // TEST_STAGE_NUMBER + } // namespace Tempus_Test diff --git a/packages/tempus/test/HHTAlpha/Tempus_HHTAlphaTest.cpp b/packages/tempus/test/HHTAlpha/Tempus_HHTAlphaTest.cpp index fc66eb8c82a0..5246c882837e 100644 --- a/packages/tempus/test/HHTAlpha/Tempus_HHTAlphaTest.cpp +++ b/packages/tempus/test/HHTAlpha/Tempus_HHTAlphaTest.cpp @@ -48,15 +48,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_BALL_PARABOLIC -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS_SECONDORDER -#define TEST_SINCOS_FIRSTORDER -#define TEST_SINCOS_CD - -#ifdef TEST_BALL_PARABOLIC // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(HHTAlpha, BallParabolic) @@ -120,10 +112,8 @@ TEUCHOS_UNIT_TEST(HHTAlpha, BallParabolic) "\n Test failed! Max error = " << err << " > tolerance = " << tolerance << "\n!"); } -#endif // TEST_BALL_PARABOLIC -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(HHTAlpha, ConstructingFromDefaults) @@ -214,10 +204,8 @@ TEUCHOS_UNIT_TEST(HHTAlpha, ConstructingFromDefaults) std::cout << " =========================" << std::endl; TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.144918, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS_SECONDORDER // ************************************************************ TEUCHOS_UNIT_TEST(HHTAlpha, SinCos_SecondOrder) { @@ -360,10 +348,8 @@ TEUCHOS_UNIT_TEST(HHTAlpha, SinCos_SecondOrder) TEST_FLOATING_EQUALITY( xDotSlope, order, 0.01 ); TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 0.104392, 1.0e-4 ); } -#endif // TEST_SINCOS_SECONDORDER -#ifdef TEST_SINCOS_FIRSTORDER // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(HHTAlpha, SinCos_FirstOrder) @@ -508,10 +494,8 @@ TEUCHOS_UNIT_TEST(HHTAlpha, SinCos_FirstOrder) TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 0.393504, 1.0e-4 ); } -#endif // TEST_SINCOS_FIRSTORDER -#ifdef TEST_SINCOS_CD // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(HHTAlpha, SinCos_CD) @@ -655,6 +639,6 @@ TEUCHOS_UNIT_TEST(HHTAlpha, SinCos_CD) TEST_FLOATING_EQUALITY( xDotSlope, order, 0.01 ); TEST_FLOATING_EQUALITY( xDotErrorNorm[0], 0.0551522, 1.0e-4 ); } -#endif // TEST_SINCOS_CD + } diff --git a/packages/tempus/test/IMEX_RK/Tempus_IMEX_RKTest.cpp b/packages/tempus/test/IMEX_RK/Tempus_IMEX_RKTest.cpp index 313de6b88777..b0e63f0a95d9 100644 --- a/packages/tempus/test/IMEX_RK/Tempus_IMEX_RKTest.cpp +++ b/packages/tempus/test/IMEX_RK/Tempus_IMEX_RKTest.cpp @@ -36,12 +36,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_VANDERPOL - -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK, ConstructingFromDefaults) @@ -105,7 +100,6 @@ TEUCHOS_UNIT_TEST(IMEX_RK, ConstructingFromDefaults) integrator->setStepperWStepper(stepper); integrator->setTimeStepControl(timeStepControl); integrator->setSolutionHistory(solutionHistory); - //integrator->setObserver(...); integrator->initialize(); @@ -132,10 +126,8 @@ TEUCHOS_UNIT_TEST(IMEX_RK, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 1.810210, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), -0.754602, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK, VanDerPol) @@ -283,7 +275,6 @@ TEUCHOS_UNIT_TEST(IMEX_RK, VanDerPol) } //Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL } // namespace Tempus_Test diff --git a/packages/tempus/test/IMEX_RK_Partitioned/Tempus_IMEX_RK_PartitionedTest.cpp b/packages/tempus/test/IMEX_RK_Partitioned/Tempus_IMEX_RK_PartitionedTest.cpp index aa410040c918..ca45f46f9d89 100644 --- a/packages/tempus/test/IMEX_RK_Partitioned/Tempus_IMEX_RK_PartitionedTest.cpp +++ b/packages/tempus/test/IMEX_RK_Partitioned/Tempus_IMEX_RK_PartitionedTest.cpp @@ -37,12 +37,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_VANDERPOL - -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK_Partitioned, ConstructingFromDefaults) @@ -137,10 +132,8 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partitioned, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 1.810210, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), -0.754602, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK_Partitioned, VanDerPol) @@ -280,7 +273,6 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partitioned, VanDerPol) } Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL } // namespace Tempus_Test diff --git a/packages/tempus/test/Leapfrog/Tempus_LeapfrogTest.cpp b/packages/tempus/test/Leapfrog/Tempus_LeapfrogTest.cpp index fef6b9de7340..f93e4c04228c 100644 --- a/packages/tempus/test/Leapfrog/Tempus_LeapfrogTest.cpp +++ b/packages/tempus/test/Leapfrog/Tempus_LeapfrogTest.cpp @@ -45,12 +45,7 @@ using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS - -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Leapfrog, ConstructingFromDefaults) @@ -141,10 +136,8 @@ TEUCHOS_UNIT_TEST(Leapfrog, ConstructingFromDefaults) std::cout << " =========================" << std::endl; TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.167158, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Leapfrog, SinCos) @@ -254,6 +247,6 @@ TEUCHOS_UNIT_TEST(Leapfrog, SinCos) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_SINCOS + } diff --git a/packages/tempus/test/OperatorSplit/Tempus_OperatorSplitTest.cpp b/packages/tempus/test/OperatorSplit/Tempus_OperatorSplitTest.cpp index 3ee1ebe00bc8..364b314e9de4 100644 --- a/packages/tempus/test/OperatorSplit/Tempus_OperatorSplitTest.cpp +++ b/packages/tempus/test/OperatorSplit/Tempus_OperatorSplitTest.cpp @@ -38,12 +38,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_VANDERPOL - -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(OperatorSplit, ConstructingFromDefaults) @@ -143,10 +138,8 @@ TEUCHOS_UNIT_TEST(OperatorSplit, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), -2.223910, 1.0e-4); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.565441, 1.0e-4); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(OperatorSplit, VanDerPol) @@ -237,6 +230,6 @@ TEUCHOS_UNIT_TEST(OperatorSplit, VanDerPol) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL + } // namespace Tempus_Test diff --git a/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp b/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp index 84e5534e6e0b..1e01885d1729 100644 --- a/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp +++ b/packages/tempus/test/Subcycling/Tempus_SubcyclingTest.cpp @@ -41,14 +41,6 @@ using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -//#define TEST_PARAMETERLIST -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS_ADAPT -#define TEST_VANDERPOL_OPERATOR_SPLIT - - -#ifdef TEST_PARAMETERLIST // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Subcycling, ParameterList) @@ -103,10 +95,8 @@ TEUCHOS_UNIT_TEST(Subcycling, ParameterList) TEST_ASSERT(pass) } } -#endif // TEST_PARAMETERLIST -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Subcycling, ConstructingFromDefaults) @@ -204,10 +194,8 @@ TEUCHOS_UNIT_TEST(Subcycling, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.882508, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.570790, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS_ADAPT // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Subcycling, SinCosAdapt) @@ -371,10 +359,8 @@ TEUCHOS_UNIT_TEST(Subcycling, SinCosAdapt) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_SINCOS_ADAPT -#ifdef TEST_VANDERPOL_OPERATOR_SPLIT // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Subcycling, VanDerPolOperatorSplit) @@ -538,7 +524,6 @@ TEUCHOS_UNIT_TEST(Subcycling, VanDerPolOperatorSplit) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL_OPERATOR_SPLIT } // namespace Tempus_Test diff --git a/packages/tempus/test/Trapezoidal/Tempus_TrapezoidalTest.cpp b/packages/tempus/test/Trapezoidal/Tempus_TrapezoidalTest.cpp index 9af3ec0971ea..9616d1fe1039 100644 --- a/packages/tempus/test/Trapezoidal/Tempus_TrapezoidalTest.cpp +++ b/packages/tempus/test/Trapezoidal/Tempus_TrapezoidalTest.cpp @@ -46,14 +46,7 @@ using Tempus::IntegratorBasic; using Tempus::SolutionHistory; using Tempus::SolutionState; -// Comment out any of the following tests to exclude from build/run. -#define TEST_PARAMETERLIST -#define TEST_CONSTRUCTING_FROM_DEFAULTS -#define TEST_SINCOS -#define TEST_VANDERPOL - -#ifdef TEST_PARAMETERLIST // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Trapezoidal, ParameterList) @@ -104,10 +97,8 @@ TEUCHOS_UNIT_TEST(Trapezoidal, ParameterList) TEST_ASSERT(pass) } } -#endif // TEST_PARAMETERLIST -#ifdef TEST_CONSTRUCTING_FROM_DEFAULTS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Trapezoidal, ConstructingFromDefaults) @@ -216,10 +207,8 @@ TEUCHOS_UNIT_TEST(Trapezoidal, ConstructingFromDefaults) TEST_FLOATING_EQUALITY(get_ele(*(x), 0), 0.841021, 1.0e-4 ); TEST_FLOATING_EQUALITY(get_ele(*(x), 1), 0.541002, 1.0e-4 ); } -#endif // TEST_CONSTRUCTING_FROM_DEFAULTS -#ifdef TEST_SINCOS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Trapezoidal, SinCos) @@ -334,10 +323,8 @@ TEUCHOS_UNIT_TEST(Trapezoidal, SinCos) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_SINCOS -#ifdef TEST_VANDERPOL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Trapezoidal, VanDerPol) @@ -418,7 +405,6 @@ TEUCHOS_UNIT_TEST(Trapezoidal, VanDerPol) Teuchos::TimeMonitor::summarize(); } -#endif // TEST_VANDERPOL } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/CMakeLists.txt b/packages/tempus/unit_test/CMakeLists.txt index 0746b31e6bd8..c9422491810a 100644 --- a/packages/tempus/unit_test/CMakeLists.txt +++ b/packages/tempus/unit_test/CMakeLists.txt @@ -99,6 +99,13 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST( NUM_MPI_PROCS 1 ) +TRIBITS_ADD_EXECUTABLE_AND_TEST( + UnitTest_SDIRK_3Stage2ndOrder + SOURCES Tempus_UnitTest_SDIRK_3Stage2ndOrder.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} + TESTONLYLIBS tempus_test_models + NUM_MPI_PROCS 1 + ) + TRIBITS_ADD_EXECUTABLE_AND_TEST( UnitTest_SDIRK_3Stage4thOrder SOURCES Tempus_UnitTest_SDIRK_3Stage4thOrder.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} @@ -127,6 +134,34 @@ TRIBITS_ADD_EXECUTABLE_AND_TEST( NUM_MPI_PROCS 1 ) +TRIBITS_ADD_EXECUTABLE_AND_TEST( + UnitTest_SSPDIRK22 + SOURCES Tempus_UnitTest_SSPDIRK22.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} + TESTONLYLIBS tempus_test_models + NUM_MPI_PROCS 1 + ) + +TRIBITS_ADD_EXECUTABLE_AND_TEST( + UnitTest_SSPDIRK23 + SOURCES Tempus_UnitTest_SSPDIRK23.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} + TESTONLYLIBS tempus_test_models + NUM_MPI_PROCS 1 + ) + +TRIBITS_ADD_EXECUTABLE_AND_TEST( + UnitTest_SSPDIRK32 + SOURCES Tempus_UnitTest_SSPDIRK32.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} + TESTONLYLIBS tempus_test_models + NUM_MPI_PROCS 1 + ) + +TRIBITS_ADD_EXECUTABLE_AND_TEST( + UnitTest_SSPDIRK33 + SOURCES Tempus_UnitTest_SSPDIRK33.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} + TESTONLYLIBS tempus_test_models + NUM_MPI_PROCS 1 + ) + TRIBITS_ADD_EXECUTABLE_AND_TEST( UnitTest_ERK_3_8Rule SOURCES Tempus_UnitTest_ERK_3_8Rule.cpp ${TEUCHOS_STD_UNIT_TEST_MAIN} diff --git a/packages/tempus/unit_test/Tempus_UnitTest_BDF2.cpp b/packages/tempus/unit_test/Tempus_UnitTest_BDF2.cpp index 4f769e22d764..fe90ed699ce8 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_BDF2.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_BDF2.cpp @@ -36,14 +36,11 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; // Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(BDF2, Construction) +TEUCHOS_UNIT_TEST(BDF2, Default_Construction) { auto model = rcp(new Tempus_Test::SinCosModel()); @@ -85,11 +82,11 @@ TEUCHOS_UNIT_TEST(BDF2, Construction) ICConsistency, ICConsistencyCheck, zeroInitialGuess)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(BDF2, StepperFactory_Construction) @@ -97,7 +94,6 @@ TEUCHOS_UNIT_TEST(BDF2, StepperFactory_Construction) auto model = rcp(new Tempus_Test::SinCosModel()); testFactoryConstruction("BDF2", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp b/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp index a2533f4a1002..e72a7bd43f51 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_BackwardEuler.cpp @@ -43,7 +43,7 @@ using Tempus::StepperFactory; // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(BackwardEuler, Construction) +TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction) { auto model = rcp(new Tempus_Test::SinCosModel()); @@ -96,6 +96,9 @@ TEUCHOS_UNIT_TEST(BackwardEuler, Construction) model, solver, predictorStepper, useFSAL, ICConsistency, ICConsistencyCheck, zeroInitialGuess, modifier)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1Stage1stOrderRadauIA.cpp b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1Stage1stOrderRadauIA.cpp index 7585bbcd52fe..27ce6d4cd2b8 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1Stage1stOrderRadauIA.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1Stage1stOrderRadauIA.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_1Stage1stOrderRadauIA, Default_Construction) { - testDIRKAccessorsFullConstruction("RK Implicit 1 Stage 1st order Radau IA"); + auto stepper = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(DIRK_1Stage1stOrderRadauIA, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_1Stage1stOrderRadauIA, AppAction) { - testRKAppAction("RK Implicit 1 Stage 1st order Radau IA", out, success); + auto stepper = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1StageTheta.cpp b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1StageTheta.cpp index 109801cc3f82..fcd14a2b2466 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1StageTheta.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_1StageTheta.cpp @@ -40,7 +40,15 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_1StageTheta, Default_Construction) { - testDIRKAccessorsFullConstruction("DIRK 1 Stage Theta Method"); + auto stepper = rcp(new Tempus::StepperDIRK_1StageTheta()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); + double theta = 0.5; + TEUCHOS_ASSERT(stepper->getTheta() == theta); + stepper->setTheta(theta); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + } @@ -57,7 +65,9 @@ TEUCHOS_UNIT_TEST(DIRK_1StageTheta, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_1StageTheta, AppAction) { - testRKAppAction("DIRK 1 Stage Theta Method", out, success); + auto stepper = rcp(new Tempus::StepperDIRK_1StageTheta()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_2Stage2ndOrderLobattoIIIB.cpp b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_2Stage2ndOrderLobattoIIIB.cpp index afec1c9424ed..e681c8ebadb8 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_2Stage2ndOrderLobattoIIIB.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_2Stage2ndOrderLobattoIIIB.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_2Stage2ndOrderLobattoIIIB, Default_Construction) { - testDIRKAccessorsFullConstruction("RK Implicit 2 Stage 2nd order Lobatto IIIB"); + auto stepper=rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(DIRK_2Stage2ndOrderLobattoIIIB, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_2Stage2ndOrderLobattoIIIB, AppAction) { - testRKAppAction("RK Implicit 2 Stage 2nd order Lobatto IIIB", out, success); + auto stepper = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_BackwardEuler.cpp b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_BackwardEuler.cpp index 051109e43ee9..64f3bd21a85b 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_BackwardEuler.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_BackwardEuler.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, Default_Construction) { - testDIRKAccessorsFullConstruction("RK Backward Euler"); + auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_BackwardEuler, AppAction) { - testRKAppAction("RK Backward Euler", out, success); + auto stepper = rcp(new Tempus::StepperDIRK_BackwardEuler()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp index 39800063500d..efd6b6d4629c 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_DIRK_General.cpp @@ -111,6 +111,8 @@ TEUCHOS_UNIT_TEST(DIRK_General, Default_Construction) A, b, c, order, order, order, bstar)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -127,7 +129,9 @@ TEUCHOS_UNIT_TEST(DIRK_General, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(DIRK_General, AppAction) { - testRKAppAction("General DIRK", out, success); + auto stepper = rcp(new Tempus::StepperDIRK_General()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2Stage3rdOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2Stage3rdOrder.cpp index bb755680e6bf..5379aa9127f8 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2Stage3rdOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2Stage3rdOrder.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(EDIRK_2Stage3rdOrder, Default_Construction) { - testDIRKAccessorsFullConstruction("EDIRK 2 Stage 3rd order"); + auto stepper = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(EDIRK_2Stage3rdOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(EDIRK_2Stage3rdOrder, AppAction) { - testRKAppAction("EDIRK 2 Stage 3rd order", out, success); + auto stepper = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2StageTheta.cpp b/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2StageTheta.cpp index 168ca815b780..3568810cb754 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2StageTheta.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_2StageTheta.cpp @@ -40,7 +40,15 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(EDIRK_2StageTheta, Default_Construction) { - testDIRKAccessorsFullConstruction("EDIRK 2 Stage Theta Method"); + auto stepper = rcp(new Tempus::StepperEDIRK_2StageTheta()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); + double theta = 0.5; + TEUCHOS_ASSERT(stepper->getTheta() == theta); + stepper->setTheta(theta); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + } @@ -57,7 +65,9 @@ TEUCHOS_UNIT_TEST(EDIRK_2StageTheta, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(EDIRK_2StageTheta, AppAction) { - testRKAppAction("EDIRK 2 Stage Theta Method", out, success); + auto stepper = rcp(new Tempus::StepperEDIRK_2StageTheta()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_TrapezoidalRule.cpp b/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_TrapezoidalRule.cpp index 94468c2c139b..8969d118ee32 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_TrapezoidalRule.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_EDIRK_TrapezoidalRule.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(EDIRK_TrapezoidalRule, Default_Construction) { - testDIRKAccessorsFullConstruction("RK Trapezoidal Rule"); + auto stepper = rcp(new Tempus::StepperEDIRK_TrapezoidalRule()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(EDIRK_TrapezoidalRule, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(EDIRK_TrapezoidalRule, AppAction) { - testRKAppAction("RK Trapezoidal Rule", out, success); + auto stepper = rcp(new Tempus::StepperEDIRK_TrapezoidalRule()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrder.cpp index 43007dbbc50d..6e47c34243ce 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrder.cpp @@ -25,7 +25,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrder, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 3 Stage 3rd order"); + auto stepper = rcp(new Tempus::StepperERK_3Stage3rdOrder()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -42,7 +46,9 @@ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrder, AppAction) { - testRKAppAction("RK Explicit 3 Stage 3rd order", out, success); + auto stepper = rcp(new Tempus::StepperERK_3Stage3rdOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderHeun.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderHeun.cpp index 0ee72dd45551..e1bdd5ff2d0c 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderHeun.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderHeun.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrderHeun, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 3 Stage 3rd order by Heun"); + auto stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrderHeun, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrderHeun, AppAction) { - testRKAppAction("RK Explicit 3 Stage 3rd order by Heun", out, success); + auto stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderTVD.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderTVD.cpp index 5bdd5b0cfac9..ae0b47dc848a 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderTVD.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3Stage3rdOrderTVD.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrderTVD, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 3 Stage 3rd order TVD"); + auto stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrderTVD, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3Stage3rdOrderTVD, AppAction) { - testRKAppAction("RK Explicit 3 Stage 3rd order TVD", out, success); + auto stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3_8Rule.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3_8Rule.cpp index 9ad56701f666..3390b7552a1d 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_3_8Rule.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_3_8Rule.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3_8Rule, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 3/8 Rule"); + auto stepper = rcp(new Tempus::StepperERK_3_8Rule()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 4); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_3_8Rule, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_3_8Rule, AppAction) { - testRKAppAction("RK Explicit 3/8 Rule", out, success); + auto stepper = rcp(new Tempus::StepperERK_3_8Rule()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage3rdOrderRunge.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage3rdOrderRunge.cpp index 8c4a3706cae2..947b8a152216 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage3rdOrderRunge.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage3rdOrderRunge.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_4Stage3rdOrderRunge, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 4 Stage 3rd order by Runge"); + auto stepper = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_4Stage3rdOrderRunge, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_4Stage3rdOrderRunge, AppAction) { - testRKAppAction("RK Explicit 4 Stage 3rd order by Runge", out, success); + auto stepper = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage4thOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage4thOrder.cpp index 00d770a7ed8e..0649b1bd5511 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage4thOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_4Stage4thOrder.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_4Stage4thOrder, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 4 Stage"); + auto stepper = rcp(new Tempus::StepperERK_4Stage4thOrder()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 4); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_4Stage4thOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_4Stage4thOrder, AppAction) { - testRKAppAction("RK Explicit 4 Stage", out, success); + auto stepper = rcp(new Tempus::StepperERK_4Stage4thOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_5Stage3rdOrderKandG.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_5Stage3rdOrderKandG.cpp index 1805f543e6ba..52bc0d45a7bb 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_5Stage3rdOrderKandG.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_5Stage3rdOrderKandG.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_5Stage3rdOrderKandG, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit 5 Stage 3rd order by Kinnmark and Gray"); + auto stepper = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_5Stage3rdOrderKandG, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_5Stage3rdOrderKandG, AppAction) { - testRKAppAction("RK Explicit 5 Stage 3rd order by Kinnmark and Gray", out, success); + auto stepper = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_BogackiShampine32.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_BogackiShampine32.cpp index 2237ca2281f9..57e61f3a23dd 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_BogackiShampine32.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_BogackiShampine32.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_BogackiShampine32, Default_Construction) { - testExplicitRKAccessorsFullConstruction("Bogacki-Shampine 3(2) Pair"); + auto stepper = rcp(new Tempus::StepperERK_BogackiShampine32()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_BogackiShampine32, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_BogackiShampine32, AppAction) { - testRKAppAction("Bogacki-Shampine 3(2) Pair", out, success); + auto stepper = rcp(new Tempus::StepperERK_BogackiShampine32()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_ForwardEuler.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_ForwardEuler.cpp index ad6d1e54e0d4..d9495b6c5c3e 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_ForwardEuler.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_ForwardEuler.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_ForwardEuler, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Forward Euler"); + auto stepper = rcp(new Tempus::StepperERK_ForwardEuler()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_ForwardEuler, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_ForwardEuler, AppAction) { - testRKAppAction("RK Forward Euler", out, success); + auto stepper = rcp(new Tempus::StepperERK_ForwardEuler()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp index a8708fb48650..5b295ede2c36 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_General.cpp @@ -88,6 +88,8 @@ TEUCHOS_UNIT_TEST(ERK_General, Default_Construction) A, b, c, order, order, order, bstar, modifier)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 4); } @@ -104,7 +106,9 @@ TEUCHOS_UNIT_TEST(ERK_General, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_General, AppAction) { - testRKAppAction("General ERK", out, success); + auto stepper = rcp(new Tempus::StepperERK_General()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_Merson45.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_Merson45.cpp index 959ba8cd907c..1a44e5a52b0d 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_Merson45.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_Merson45.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_Merson45, Default_Construction) { - testExplicitRKAccessorsFullConstruction("Merson 4(5) Pair"); + auto stepper = rcp(new Tempus::StepperERK_Merson45()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 4); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_Merson45, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_Merson45, AppAction) { - testRKAppAction("Merson 4(5) Pair", out, success); + auto stepper = rcp(new Tempus::StepperERK_Merson45()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_Midpoint.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_Midpoint.cpp index 8d2bdd2c3072..fe8d289c4f8d 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_Midpoint.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_Midpoint.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_Midpoint, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit Midpoint"); + auto stepper = rcp(new Tempus::StepperERK_Midpoint()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_Midpoint, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_Midpoint, AppAction) { - testRKAppAction("RK Explicit Midpoint", out, success); + auto stepper = rcp(new Tempus::StepperERK_Midpoint()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ERK_Trapezoidal.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ERK_Trapezoidal.cpp index 1f8c1b34d795..493aadd0e644 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ERK_Trapezoidal.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ERK_Trapezoidal.cpp @@ -24,7 +24,11 @@ using Teuchos::rcp_dynamic_cast; // ************************************************************ TEUCHOS_UNIT_TEST(ERK_Trapezoidal, Default_Construction) { - testExplicitRKAccessorsFullConstruction("RK Explicit Trapezoidal"); + auto stepper = rcp(new Tempus::StepperERK_Trapezoidal()); + testExplicitRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -41,7 +45,9 @@ TEUCHOS_UNIT_TEST(ERK_Trapezoidal, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(ERK_Trapezoidal, AppAction) { - testRKAppAction("RK Explicit Trapezoidal", out, success); + auto stepper = rcp(new Tempus::StepperERK_Trapezoidal()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp b/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp index e8a0d1465f40..1c49596a1bc0 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_ForwardEuler.cpp @@ -43,11 +43,8 @@ using Tempus::StepperFactory; using Tempus::StepperExplicitRK; // Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ForwardEuler, Default_Construction) @@ -85,11 +82,11 @@ TEUCHOS_UNIT_TEST(ForwardEuler, Default_Construction) model, useFSAL, ICConsistency, ICConsistencyCheck,modifier)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(ForwardEuler, StepperFactory_Construction) @@ -97,7 +94,6 @@ TEUCHOS_UNIT_TEST(ForwardEuler, StepperFactory_Construction) auto model = rcp(new Tempus_Test::SinCosModel()); testFactoryConstruction("Forward Euler", model); } -#endif // STEPPERFACTORY_CONSTRUCTION // ************************************************************ diff --git a/packages/tempus/unit_test/Tempus_UnitTest_HHTAlpha.cpp b/packages/tempus/unit_test/Tempus_UnitTest_HHTAlpha.cpp index 4611bf10c11e..612ab1adceea 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_HHTAlpha.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_HHTAlpha.cpp @@ -36,15 +36,10 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(HHTAlpha, Construction) +TEUCHOS_UNIT_TEST(HHTAlpha, Default_Construction) { auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); @@ -91,11 +86,11 @@ TEUCHOS_UNIT_TEST(HHTAlpha, Construction) schemeName, beta, gamma, alpha_f, alpha_m)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(HHTAlpha, StepperFactory_Construction) @@ -103,7 +98,6 @@ TEUCHOS_UNIT_TEST(HHTAlpha, StepperFactory_Construction) auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); testFactoryConstruction("HHT-Alpha", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp index 794e921afccc..7405b3b60c7c 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp @@ -37,14 +37,7 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; using Tempus::StepperExplicitRK; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST -#define STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST_MODEL - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) @@ -62,7 +55,7 @@ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto obs = rcp(new Tempus::StepperRKObserverComposite()); + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); @@ -79,7 +72,11 @@ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) // Test the set functions. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + auto obs = rcp(new Tempus::StepperRKObserverComposite()); stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); +#endif + stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); @@ -93,17 +90,23 @@ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) // Full argument list construction. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + stepper = rcp(new Tempus::StepperIMEX_RK( + model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, + zeroInitialGuess, stepperType, explicitTableau, implicitTableau, order)); + TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); +#endif stepper = rcp(new Tempus::StepperIMEX_RK( - model, obs, solver, useFSAL, - ICConsistency, ICConsistencyCheck, zeroInitialGuess, - stepperType, explicitTableau, implicitTableau, order)); + model, solver, useFSAL, ICConsistency, ICConsistencyCheck, + zeroInitialGuess, modifier, stepperType, explicitTableau, + implicitTableau, order)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction) @@ -116,10 +119,8 @@ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction) testFactoryConstruction("IMEX RK SSP2", model); } -#endif // STEPPERFACTORY_CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist) @@ -135,10 +136,8 @@ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist) auto stepper = sf->createStepper("General IMEX RK", model); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); } -#endif // STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST -#ifdef STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST_MODEL // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist_Model) @@ -156,7 +155,21 @@ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist_ stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); } -#endif // STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST_MODEL + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(IMEX_RK, AppAction) +{ + auto stepper = rcp(new Tempus::StepperIMEX_RK()); + // Setup the IMEX Pair ModelEvaluator + auto explicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ExplicitModel()); + auto implicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ImplicitModel()); + auto model = rcp(new Tempus::WrapperModelEvaluatorPairIMEX_Basic( + explicitModel, implicitModel)); + + testRKAppAction(stepper, model, out, success); +} } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp index f7061bfc7ab2..0dedde7bbf5a 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp @@ -37,14 +37,7 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; using Tempus::StepperExplicitRK; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST -#define STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST_MODEL - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) @@ -69,7 +62,7 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); // Default values for construction. - auto obs = rcp(new Tempus::StepperRKObserverComposite()); + auto modifier = rcp(new Tempus::StepperRKModifierDefault()); auto solver = rcp(new Thyra::NOXNonlinearSolver()); solver->setParameterList(Tempus::defaultSolverParameters()); @@ -86,7 +79,11 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) // Test the set functions. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE + auto obs = rcp(new Tempus::StepperRKObserverComposite()); stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); +#endif + stepper->setAppAction(modifier); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setSolver(solver); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setUseFSAL(useFSAL); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setICConsistency(ICConsistency); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); @@ -100,17 +97,25 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) // Full argument list construction. +#ifndef TEMPUS_HIDE_DEPRECATED_CODE stepper = rcp(new Tempus::StepperIMEX_RK_Partition( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, zeroInitialGuess, stepperType, explicitTableau, implicitTableau, order)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); +#endif + stepper = rcp(new Tempus::StepperIMEX_RK_Partition( + model, solver, useFSAL, ICConsistency, ICConsistencyCheck, + zeroInitialGuess, modifier, stepperType, explicitTableau, + implicitTableau, order)); + TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + std::cout << "ordero = " << stepper->getOrder() << std::endl; + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, StepperFactory_Construction) @@ -129,13 +134,11 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, StepperFactory_Construction) testFactoryConstruction("Partitioned IMEX RK SSP2", model); } -#endif // STEPPERFACTORY_CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist) +TEUCHOS_UNIT_TEST(IMEX_RK_Partition, StepperFactory_Construction_General_wo_Parameterlist) { // Setup the explicit VanDerPol ModelEvaluator const bool useProductVector = true; @@ -154,13 +157,11 @@ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist) auto stepper = sf->createStepper("General Partitioned IMEX RK", model); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); } -#endif // STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST -#ifdef STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST_MODEL // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist_Model) +TEUCHOS_UNIT_TEST(IMEX_RK_Partition, StepperFactory_Construction_General_wo_Parameterlist_Model) { // Setup the explicit VanDerPol ModelEvaluator const bool useProductVector = true; @@ -181,7 +182,28 @@ TEUCHOS_UNIT_TEST(IMEX_RK, StepperFactory_Construction_General_wo_Parameterlist_ stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); } -#endif // STEPPERFACTORY_CONSTRUCTION_GENERAL_WO_PARAMETERLIST_MODEL + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(IMEX_RK_Partition, AppAction) +{ + auto stepper = rcp(new Tempus::StepperIMEX_RK_Partition()); + + // Setup the explicit VanDerPol ModelEvaluator + const bool useProductVector = true; + auto explicitModel = rcp(new Tempus_Test::VanDerPol_IMEX_ExplicitModel(Teuchos::null, useProductVector)); + auto implicitModel = rcp(new Tempus_Test::VanDerPol_IMEXPart_ImplicitModel()); + + // Setup the IMEX Pair ModelEvaluator + const int numExplicitBlocks = 1; + const int parameterIndex = 4; + auto model = rcp(new Tempus::WrapperModelEvaluatorPairPartIMEX_Basic( + explicitModel, implicitModel, + numExplicitBlocks, parameterIndex)); + + testRKAppAction(stepper, model, out, success); +} } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Leapfrog.cpp b/packages/tempus/unit_test/Tempus_UnitTest_Leapfrog.cpp index 7834c0a41674..49317389f743 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Leapfrog.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Leapfrog.cpp @@ -36,15 +36,10 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(Leapfrog, Construction) +TEUCHOS_UNIT_TEST(Leapfrog, Default_Construction) { auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); @@ -75,11 +70,11 @@ TEUCHOS_UNIT_TEST(Leapfrog, Construction) model, obs, useFSAL, ICConsistency, ICConsistencyCheck)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Leapfrog, StepperFactory_Construction) @@ -87,7 +82,6 @@ TEUCHOS_UNIT_TEST(Leapfrog, StepperFactory_Construction) auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); testFactoryConstruction("Leapfrog", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_NewmarkExplicitAForm.cpp b/packages/tempus/unit_test/Tempus_UnitTest_NewmarkExplicitAForm.cpp index ebe76dcd59a6..5bdc2cac5680 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_NewmarkExplicitAForm.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_NewmarkExplicitAForm.cpp @@ -36,15 +36,10 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(NewmarkExplicitAForm, Construction) +TEUCHOS_UNIT_TEST(NewmarkExplicitAForm, Default_Construction) { auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); @@ -75,11 +70,11 @@ TEUCHOS_UNIT_TEST(NewmarkExplicitAForm, Construction) model, Teuchos::null, useFSAL, ICConsistency, ICConsistencyCheck, gamma)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(NewmarkExplicitAForm, StepperFactory_Construction) @@ -87,7 +82,6 @@ TEUCHOS_UNIT_TEST(NewmarkExplicitAForm, StepperFactory_Construction) auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); testFactoryConstruction("Newmark Explicit a-Form", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitAForm.cpp b/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitAForm.cpp index 8a857d78a1d8..9de83aa2505d 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitAForm.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitAForm.cpp @@ -36,15 +36,10 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(NewmarkImplicitAForm, Construction) +TEUCHOS_UNIT_TEST(NewmarkImplicitAForm, Default_Construction) { auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); @@ -87,11 +82,11 @@ TEUCHOS_UNIT_TEST(NewmarkImplicitAForm, Construction) schemeName, beta, gamma)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(NewmarkImplicitAForm, StepperFactory_Construction) @@ -99,7 +94,6 @@ TEUCHOS_UNIT_TEST(NewmarkImplicitAForm, StepperFactory_Construction) auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); testFactoryConstruction("Newmark Implicit a-Form", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitDForm.cpp b/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitDForm.cpp index c5eb5e3f5d00..505d1ef05200 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitDForm.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_NewmarkImplicitDForm.cpp @@ -36,15 +36,10 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(NewmarkImplicitDForm, Construction) +TEUCHOS_UNIT_TEST(NewmarkImplicitDForm, Default_Construction) { auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); @@ -87,11 +82,11 @@ TEUCHOS_UNIT_TEST(NewmarkImplicitDForm, Construction) schemeName, beta, gamma)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(NewmarkImplicitDForm, StepperFactory_Construction) @@ -99,7 +94,6 @@ TEUCHOS_UNIT_TEST(NewmarkImplicitDForm, StepperFactory_Construction) auto model = rcp(new Tempus_Test::HarmonicOscillatorModel()); testFactoryConstruction("Newmark Implicit d-Form", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp b/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp index 951ceb9853b5..a2217e72278e 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_OperatorSplit.cpp @@ -37,12 +37,7 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; using Tempus::StepperExplicitRK; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(OperatorSplit, Default_Construction) @@ -68,7 +63,7 @@ TEUCHOS_UNIT_TEST(OperatorSplit, Default_Construction) bool useFSAL = stepper->getUseFSALDefault(); std::string ICConsistency = stepper->getICConsistencyDefault(); bool ICConsistencyCheck = stepper->getICConsistencyCheckDefault(); - int order = 2; + int order = 1; // Test the set functions. stepper->setObserver(obs); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); @@ -94,11 +89,11 @@ TEUCHOS_UNIT_TEST(OperatorSplit, Default_Construction) order, order, order)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(OperatorSplit, StepperFactory_Construction) @@ -124,7 +119,6 @@ TEUCHOS_UNIT_TEST(OperatorSplit, StepperFactory_Construction) TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_21Pair.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_21Pair.cpp index 2c5025e73e11..f162ffca46a5 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_21Pair.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_21Pair.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_21Pair, Default_Construction) { - testDIRKAccessorsFullConstruction("SDIRK 2(1) Pair"); + auto stepper = rcp(new Tempus::StepperSDIRK_21Pair()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(SDIRK_21Pair, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_21Pair, AppAction) { - testRKAppAction("SDIRK 2(1) Pair", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_21Pair()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage2ndOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage2ndOrder.cpp index 5941b1233312..000b5c688048 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage2ndOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage2ndOrder.cpp @@ -40,7 +40,14 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_2Stage2ndOrder, Default_Construction) { - testDIRKAccessorsFullConstruction("SDIRK 2 Stage 2nd order"); + auto stepper = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); + TEUCHOS_ASSERT(stepper->getGamma() == 0.2928932188134524); + stepper->setGamma(0.5); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + } @@ -57,7 +64,9 @@ TEUCHOS_UNIT_TEST(SDIRK_2Stage2ndOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_2Stage2ndOrder, AppAction) { - testRKAppAction("SDIRK 2 Stage 2nd order", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage3rdOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage3rdOrder.cpp index a64618a1e4e6..fc0d3c7401a6 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage3rdOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_2Stage3rdOrder.cpp @@ -40,7 +40,18 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, Default_Construction) { - testDIRKAccessorsFullConstruction("SDIRK 2 Stage 3rd order"); + auto stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); + std::string gammaType = "3rd Order A-stable"; + TEUCHOS_ASSERT(stepper->getGammaType() == gammaType); + double gamma = 0.7886751345948128; + TEUCHOS_ASSERT(stepper->getGamma() == gamma); + stepper->setGammaType(gammaType); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + stepper->setGamma(gamma); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + } @@ -57,7 +68,9 @@ TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_2Stage3rdOrder, AppAction) { - testRKAppAction("SDIRK 2 Stage 3rd order", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage2ndOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage2ndOrder.cpp new file mode 100644 index 000000000000..ece0b6df6247 --- /dev/null +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage2ndOrder.cpp @@ -0,0 +1,70 @@ +// @HEADER +// **************************************************************************** +// Tempus: Copyright (2017) Sandia Corporation +// +// Distributed under BSD 3-clause license (See accompanying file Copyright.txt) +// **************************************************************************** +// @HEADER + +#include "Teuchos_UnitTestHarness.hpp" +#include "Teuchos_XMLParameterListHelpers.hpp" +#include "Teuchos_TimeMonitor.hpp" +#include "Teuchos_DefaultComm.hpp" + +#include "Thyra_VectorStdOps.hpp" + +#include "Tempus_StepperFactory.hpp" +#include "Tempus_UnitTest_Utils.hpp" + +#include "../TestModels/SinCosModel.hpp" +#include "../TestModels/VanDerPolModel.hpp" +#include "../TestUtils/Tempus_ConvergenceTestUtils.hpp" + +#include +#include + +namespace Tempus_Unit_Test { + +using Teuchos::RCP; +using Teuchos::rcp; +using Teuchos::rcp_const_cast; +using Teuchos::rcp_dynamic_cast; +using Teuchos::ParameterList; +using Teuchos::sublist; +using Teuchos::getParametersFromXmlFile; + +using Tempus::StepperFactory; + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SDIRK_3Stage2ndOrder, Default_Construction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SDIRK_3Stage2ndOrder, StepperFactory_Construction) +{ + auto model = rcp(new Tempus_Test::SinCosModel()); + testFactoryConstruction("SDIRK 3 Stage 2nd order", model); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SDIRK_3Stage2ndOrder, AppAction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); +} + + +} // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage4thOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage4thOrder.cpp index caacbdd97c3c..538055aadcf7 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage4thOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_3Stage4thOrder.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_3Stage4thOrder, Default_Construction) { - testDIRKAccessorsFullConstruction("SDIRK 3 Stage 4th order"); + auto stepper = rcp(new Tempus::StepperSDIRK_3Stage4thOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 4); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(SDIRK_3Stage4thOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_3Stage4thOrder, AppAction) { - testRKAppAction("SDIRK 3 Stage 4th order", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_3Stage4thOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage4thOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage4thOrder.cpp index 2650ae75138a..81271861d832 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage4thOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage4thOrder.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_5Stage4thOrder, Default_Construction) { - testDIRKAccessorsFullConstruction("SDIRK 5 Stage 4th order"); + auto stepper = rcp(new Tempus::StepperSDIRK_5Stage4thOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 4); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(SDIRK_5Stage4thOrder, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_5Stage4thOrder, AppAction) { - testRKAppAction("SDIRK 5 Stage 4th order", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_5Stage4thOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage5thOrder.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage5thOrder.cpp index 189608730355..f9191df20cc4 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage5thOrder.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_5Stage5thOrder.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_5Stage5thOrder, Default_Construction) { - testDIRKAccessorsFullConstruction("SDIRK 5 Stage 5th order"); + auto stepper = rcp(new Tempus::StepperSDIRK_5Stage5thOrder()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 5); } @@ -69,7 +73,9 @@ TEUCHOS_UNIT_TEST(SDIRK_5Stage5thOrder, StageNumber) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_5Stage5thOrder, AppAction) { - testRKAppAction("SDIRK 5 Stage 5th order", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_5Stage5thOrder()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_ImplicitMidpoint.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_ImplicitMidpoint.cpp index 304ed7766e85..7b49bf6eea50 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_ImplicitMidpoint.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_SDIRK_ImplicitMidpoint.cpp @@ -40,7 +40,11 @@ using Tempus::StepperFactory; // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_ImplicitMidpoint, Default_Construction) { - testDIRKAccessorsFullConstruction("RK Implicit Midpoint"); + auto stepper = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } @@ -57,7 +61,9 @@ TEUCHOS_UNIT_TEST(SDIRK_ImplicitMidpoint, StepperFactory_Construction) // ************************************************************ TEUCHOS_UNIT_TEST(SDIRK_ImplicitMidpoint, AppAction) { - testRKAppAction("RK Implicit Midpoint", out, success); + auto stepper = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); } diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK22.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK22.cpp new file mode 100644 index 000000000000..44edbbeb120d --- /dev/null +++ b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK22.cpp @@ -0,0 +1,70 @@ +// @HEADER +// **************************************************************************** +// Tempus: Copyright (2017) Sandia Corporation +// +// Distributed under BSD 3-clause license (See accompanying file Copyright.txt) +// **************************************************************************** +// @HEADER + +#include "Teuchos_UnitTestHarness.hpp" +#include "Teuchos_XMLParameterListHelpers.hpp" +#include "Teuchos_TimeMonitor.hpp" +#include "Teuchos_DefaultComm.hpp" + +#include "Thyra_VectorStdOps.hpp" + +#include "Tempus_StepperFactory.hpp" +#include "Tempus_UnitTest_Utils.hpp" + +#include "../TestModels/SinCosModel.hpp" +#include "../TestModels/VanDerPolModel.hpp" +#include "../TestUtils/Tempus_ConvergenceTestUtils.hpp" + +#include +#include + +namespace Tempus_Unit_Test { + +using Teuchos::RCP; +using Teuchos::rcp; +using Teuchos::rcp_const_cast; +using Teuchos::rcp_dynamic_cast; +using Teuchos::ParameterList; +using Teuchos::sublist; +using Teuchos::getParametersFromXmlFile; + +using Tempus::StepperFactory; + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK22, Default_Construction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK22()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK22, StepperFactory_Construction) +{ + auto model = rcp(new Tempus_Test::SinCosModel()); + testFactoryConstruction("SSPDIRK22", model); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK22, AppAction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK22()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); +} + + +} // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK23.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK23.cpp new file mode 100644 index 000000000000..9767f88fcf78 --- /dev/null +++ b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK23.cpp @@ -0,0 +1,70 @@ +// @HEADER +// **************************************************************************** +// Tempus: Copyright (2017) Sandia Corporation +// +// Distributed under BSD 3-clause license (See accompanying file Copyright.txt) +// **************************************************************************** +// @HEADER + +#include "Teuchos_UnitTestHarness.hpp" +#include "Teuchos_XMLParameterListHelpers.hpp" +#include "Teuchos_TimeMonitor.hpp" +#include "Teuchos_DefaultComm.hpp" + +#include "Thyra_VectorStdOps.hpp" + +#include "Tempus_StepperFactory.hpp" +#include "Tempus_UnitTest_Utils.hpp" + +#include "../TestModels/SinCosModel.hpp" +#include "../TestModels/VanDerPolModel.hpp" +#include "../TestUtils/Tempus_ConvergenceTestUtils.hpp" + +#include +#include + +namespace Tempus_Unit_Test { + +using Teuchos::RCP; +using Teuchos::rcp; +using Teuchos::rcp_const_cast; +using Teuchos::rcp_dynamic_cast; +using Teuchos::ParameterList; +using Teuchos::sublist; +using Teuchos::getParametersFromXmlFile; + +using Tempus::StepperFactory; + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK23, Default_Construction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK23()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK23, StepperFactory_Construction) +{ + auto model = rcp(new Tempus_Test::SinCosModel()); + testFactoryConstruction("SSPDIRK23", model); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK23, AppAction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK23()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); +} + + +} // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK32.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK32.cpp new file mode 100644 index 000000000000..599be58e0574 --- /dev/null +++ b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK32.cpp @@ -0,0 +1,70 @@ +// @HEADER +// **************************************************************************** +// Tempus: Copyright (2017) Sandia Corporation +// +// Distributed under BSD 3-clause license (See accompanying file Copyright.txt) +// **************************************************************************** +// @HEADER + +#include "Teuchos_UnitTestHarness.hpp" +#include "Teuchos_XMLParameterListHelpers.hpp" +#include "Teuchos_TimeMonitor.hpp" +#include "Teuchos_DefaultComm.hpp" + +#include "Thyra_VectorStdOps.hpp" + +#include "Tempus_StepperFactory.hpp" +#include "Tempus_UnitTest_Utils.hpp" + +#include "../TestModels/SinCosModel.hpp" +#include "../TestModels/VanDerPolModel.hpp" +#include "../TestUtils/Tempus_ConvergenceTestUtils.hpp" + +#include +#include + +namespace Tempus_Unit_Test { + +using Teuchos::RCP; +using Teuchos::rcp; +using Teuchos::rcp_const_cast; +using Teuchos::rcp_dynamic_cast; +using Teuchos::ParameterList; +using Teuchos::sublist; +using Teuchos::getParametersFromXmlFile; + +using Tempus::StepperFactory; + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK32, Default_Construction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK32()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK32, StepperFactory_Construction) +{ + auto model = rcp(new Tempus_Test::SinCosModel()); + testFactoryConstruction("SSPDIRK32", model); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK32, AppAction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK32()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); +} + + +} // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK33.cpp b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK33.cpp new file mode 100644 index 000000000000..3c2b155f40f4 --- /dev/null +++ b/packages/tempus/unit_test/Tempus_UnitTest_SSPDIRK33.cpp @@ -0,0 +1,70 @@ +// @HEADER +// **************************************************************************** +// Tempus: Copyright (2017) Sandia Corporation +// +// Distributed under BSD 3-clause license (See accompanying file Copyright.txt) +// **************************************************************************** +// @HEADER + +#include "Teuchos_UnitTestHarness.hpp" +#include "Teuchos_XMLParameterListHelpers.hpp" +#include "Teuchos_TimeMonitor.hpp" +#include "Teuchos_DefaultComm.hpp" + +#include "Thyra_VectorStdOps.hpp" + +#include "Tempus_StepperFactory.hpp" +#include "Tempus_UnitTest_Utils.hpp" + +#include "../TestModels/SinCosModel.hpp" +#include "../TestModels/VanDerPolModel.hpp" +#include "../TestUtils/Tempus_ConvergenceTestUtils.hpp" + +#include +#include + +namespace Tempus_Unit_Test { + +using Teuchos::RCP; +using Teuchos::rcp; +using Teuchos::rcp_const_cast; +using Teuchos::rcp_dynamic_cast; +using Teuchos::ParameterList; +using Teuchos::sublist; +using Teuchos::getParametersFromXmlFile; + +using Tempus::StepperFactory; + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK33, Default_Construction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK33()); + testDIRKAccessorsFullConstruction(stepper); + + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 3); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK33, StepperFactory_Construction) +{ + auto model = rcp(new Tempus_Test::SinCosModel()); + testFactoryConstruction("SSPDIRK33", model); +} + + +// ************************************************************ +// ************************************************************ +TEUCHOS_UNIT_TEST(SSPDIRK33, AppAction) +{ + auto stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK33()); + auto model = rcp(new Tempus_Test::SinCosModel()); + testRKAppAction(stepper, model, out, success); +} + + +} // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp b/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp index edf725641150..c918b1e50dc7 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Subcycling.cpp @@ -35,12 +35,7 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; using Tempus::StepperExplicitRK; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define MAXTIMESTEPDOESNOTCHANGEDURING_TAKESTEP - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Subcycling, Default_Construction) @@ -82,11 +77,11 @@ TEUCHOS_UNIT_TEST(Subcycling, Default_Construction) model, obs, scIntegrator, useFSAL, ICConsistency, ICConsistencyCheck)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 1); } -#endif // CONSTRUCTION -#ifdef MAXTIMESTEPDOESNOTCHANGEDURING_TAKESTEP // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Subcycling, MaxTimeStepDoesNotChangeDuring_takeStep) @@ -116,7 +111,6 @@ TEUCHOS_UNIT_TEST(Subcycling, MaxTimeStepDoesNotChangeDuring_takeStep) TEST_FLOATING_EQUALITY(maxTimeStep_Set, maxTimeStep_After, 1.0e-14 ); } -#endif // MAXTIMESTEPDOESNOTCHANGEDURING_TAKESTEP } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_TimeStepControl.cpp b/packages/tempus/unit_test/Tempus_UnitTest_TimeStepControl.cpp index 8c8e56a3e0bb..d8da5860b06a 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_TimeStepControl.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_TimeStepControl.cpp @@ -30,12 +30,7 @@ using Teuchos::ParameterList; using Teuchos::sublist; using Teuchos::getParametersFromXmlFile; -// Comment out any of the following tests to exclude from build/run. -#define SETOUTPUTTIMES -#define SETANDGETOUTPUTINDICESANDINTERVALS - -#ifdef SETOUTPUTTIMES // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(TimeStepControl, setOutputTimes) @@ -109,10 +104,8 @@ TEUCHOS_UNIT_TEST(TimeStepControl, setOutputTimes) //tscPL = tsc->getParameterList(); //std::cout << "tscPL = \n" << *tscPL << std::endl; } -#endif // SETOUTPUTTIMES -#ifdef SETANDGETOUTPUTINDICESANDINTERVALS // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(TimeStepControl, getOutputIndicesandIntervals){ @@ -128,7 +121,6 @@ TEUCHOS_UNIT_TEST(TimeStepControl, getOutputIndicesandIntervals){ TEST_COMPARE(getOutputTimeInterval, ==, setOutputTimeInterval); TEST_COMPARE(getOutputTimeIndex, ==, setOutputTimeIndex); } -#endif // SETANDGETOUTPUTINDICESANDINTERVALS } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Trapezoidal.cpp b/packages/tempus/unit_test/Tempus_UnitTest_Trapezoidal.cpp index 9ce3a3ed166a..675102793872 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Trapezoidal.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Trapezoidal.cpp @@ -35,15 +35,10 @@ using Teuchos::getParametersFromXmlFile; using Tempus::StepperFactory; -// Comment out any of the following tests to exclude from build/run. -#define CONSTRUCTION -#define STEPPERFACTORY_CONSTRUCTION - -#ifdef CONSTRUCTION // ************************************************************ // ************************************************************ -TEUCHOS_UNIT_TEST(Trapezoidal, Construction) +TEUCHOS_UNIT_TEST(Trapezoidal, Default_Construction) { auto model = rcp(new Tempus_Test::SinCosModel()); @@ -79,11 +74,11 @@ TEUCHOS_UNIT_TEST(Trapezoidal, Construction) ICConsistency, ICConsistencyCheck, zeroInitialGuess)); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + // Test stepper properties. + TEUCHOS_ASSERT(stepper->getOrder() == 2); } -#endif // CONSTRUCTION -#ifdef STEPPERFACTORY_CONSTRUCTION // ************************************************************ // ************************************************************ TEUCHOS_UNIT_TEST(Trapezoidal, StepperFactory_Construction) @@ -91,7 +86,6 @@ TEUCHOS_UNIT_TEST(Trapezoidal, StepperFactory_Construction) auto model = rcp(new Tempus_Test::SinCosModel()); testFactoryConstruction("Trapezoidal Method", model); } -#endif // STEPPERFACTORY_CONSTRUCTION } // namespace Tempus_Test diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp b/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp index 06412a394f5d..80a5e301ba2c 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp @@ -61,25 +61,9 @@ void testFactoryConstruction(std::string stepperType, /** \brief Unit test utility for ExplicitRK Stepper construction and accessors. */ -void testExplicitRKAccessorsFullConstruction(std::string stepperType) +void testExplicitRKAccessorsFullConstruction( + const RCP >& stepper) { - // Default construction. - RCP > stepper; - if (stepperType == "RK Explicit 3 Stage 3rd order") stepper = rcp(new Tempus::StepperERK_3Stage3rdOrder()); - else if (stepperType == "RK Explicit 3 Stage 3rd order by Heun") stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun()); - else if (stepperType == "RK Explicit 3 Stage 3rd order TVD") stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD()); - else if (stepperType == "RK Explicit 3/8 Rule") stepper = rcp(new Tempus::StepperERK_3_8Rule()); - else if (stepperType == "RK Explicit 4 Stage 3rd order by Runge") stepper = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge()); - else if (stepperType == "RK Explicit 4 Stage") stepper = rcp(new Tempus::StepperERK_4Stage4thOrder()); - else if (stepperType == "RK Explicit 5 Stage 3rd order by Kinnmark and Gray") stepper = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG()); - else if (stepperType == "Bogacki-Shampine 3(2) Pair") stepper = rcp(new Tempus::StepperERK_BogackiShampine32()); - else if (stepperType == "RK Forward Euler") stepper = rcp(new Tempus::StepperERK_ForwardEuler()); - else if (stepperType == "Merson 4(5) Pair") stepper = rcp(new Tempus::StepperERK_Merson45()); - else if (stepperType == "RK Explicit Midpoint") stepper = rcp(new Tempus::StepperERK_Midpoint()); - else if (stepperType == "RK Explicit Trapezoidal") stepper = rcp(new Tempus::StepperERK_Trapezoidal()); - else TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Error - unknown stepperType = "+stepperType); - - auto model = rcp(new Tempus_Test::SinCosModel()); stepper->setModel(model); stepper->initialize(); @@ -105,115 +89,116 @@ void testExplicitRKAccessorsFullConstruction(std::string stepperType) stepper->setUseEmbedded(useEmbedded); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + std::string stepperType = stepper->getStepperType(); // Full argument list construction. if (stepperType == "RK Explicit 3 Stage 3rd order") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_3Stage3rdOrder( + { auto s = rcp(new Tempus::StepperERK_3Stage3rdOrder( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_3Stage3rdOrder( + auto s = rcp(new Tempus::StepperERK_3Stage3rdOrder( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit 3 Stage 3rd order by Heun") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun( + { auto s = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun( + auto s = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit 3 Stage 3rd order TVD") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD( + { auto s = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD( + auto s = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit 3/8 Rule") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_3_8Rule( + { auto s = rcp(new Tempus::StepperERK_3_8Rule( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_3_8Rule( + auto s = rcp(new Tempus::StepperERK_3_8Rule( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit 4 Stage 3rd order by Runge") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge( + { auto s = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge( + auto s = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit 4 Stage") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_4Stage4thOrder( + { auto s = rcp(new Tempus::StepperERK_4Stage4thOrder( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_4Stage4thOrder( + auto s = rcp(new Tempus::StepperERK_4Stage4thOrder( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit 5 Stage 3rd order by Kinnmark and Gray") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG( + { auto s = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG( + auto s = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "Bogacki-Shampine 3(2) Pair") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_BogackiShampine32( + { auto s = rcp(new Tempus::StepperERK_BogackiShampine32( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_BogackiShampine32( + auto s = rcp(new Tempus::StepperERK_BogackiShampine32( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Forward Euler") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_ForwardEuler( + { auto s = rcp(new Tempus::StepperERK_ForwardEuler( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_ForwardEuler( + auto s = rcp(new Tempus::StepperERK_ForwardEuler( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "Merson 4(5) Pair") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_Merson45( + { auto s = rcp(new Tempus::StepperERK_Merson45( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_Merson45( + auto s = rcp(new Tempus::StepperERK_Merson45( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit Midpoint") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_Midpoint( + { auto s = rcp(new Tempus::StepperERK_Midpoint( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_Midpoint( + auto s = rcp(new Tempus::StepperERK_Midpoint( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Explicit Trapezoidal") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperERK_Trapezoidal( + { auto s = rcp(new Tempus::StepperERK_Trapezoidal( model, obs, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperERK_Trapezoidal( + auto s = rcp(new Tempus::StepperERK_Trapezoidal( model, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Error - unknown stepperType = "+stepperType); } @@ -221,32 +206,9 @@ void testExplicitRKAccessorsFullConstruction(std::string stepperType) /** \brief Unit test utility for ExplicitRK Stepper construction and accessors. */ -void testDIRKAccessorsFullConstruction(std::string stepperType) +void testDIRKAccessorsFullConstruction( + const RCP >& stepper) { - // Default construction. - RCP > stepper; - if (stepperType == "RK Backward Euler") stepper = rcp(new Tempus::StepperDIRK_BackwardEuler()); - else if (stepperType == "SDIRK 2 Stage 2nd order") stepper = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder()); - else if (stepperType == "SDIRK 3 Stage 2nd order") stepper = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder()); - else if (stepperType == "SDIRK 2 Stage 3rd order") stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder()); - else if (stepperType == "EDIRK 2 Stage 3rd order") stepper = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder()); - else if (stepperType == "DIRK 1 Stage Theta Method") stepper = rcp(new Tempus::StepperDIRK_1StageTheta()); - else if (stepperType == "EDIRK 2 Stage Theta Method") stepper = rcp(new Tempus::StepperEDIRK_2StageTheta()); - else if (stepperType == "RK Trapezoidal Rule") stepper = rcp(new Tempus::StepperEDIRK_TrapezoidalRule()); - else if (stepperType == "RK Implicit Midpoint") stepper = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint()); - else if (stepperType == "SSPDIRK22") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK22()); - else if (stepperType == "SSPDIRK32") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK32()); - else if (stepperType == "SSPDIRK23") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK23()); - else if (stepperType == "SSPDIRK33") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK33()); - else if (stepperType == "RK Implicit 1 Stage 1st order Radau IA") stepper = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA()); - else if (stepperType == "RK Implicit 2 Stage 2nd order Lobatto IIIB") stepper = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB()); - else if (stepperType == "SDIRK 5 Stage 4th order") stepper = rcp(new Tempus::StepperSDIRK_5Stage4thOrder()); - else if (stepperType == "SDIRK 3 Stage 4th order") stepper = rcp(new Tempus::StepperSDIRK_3Stage4thOrder()); - else if (stepperType == "SDIRK 5 Stage 5th order") stepper = rcp(new Tempus::StepperSDIRK_5Stage5thOrder()); - else if (stepperType == "SDIRK 2(1) Pair") stepper = rcp(new Tempus::StepperSDIRK_21Pair()); - else TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Error - unknown stepperType = "+stepperType); - - auto model = rcp(new Tempus_Test::SinCosModel()); stepper->setModel(model); stepper->initialize(); @@ -277,96 +239,85 @@ void testDIRKAccessorsFullConstruction(std::string stepperType) stepper->setZeroInitialGuess(zeroInitialGuess); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + std::string stepperType = stepper->getStepperType(); // Full argument list construction. if (stepperType == "RK Backward Euler") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperDIRK_BackwardEuler( + { auto s = rcp(new Tempus::StepperDIRK_BackwardEuler( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperDIRK_BackwardEuler( + auto s = rcp(new Tempus::StepperDIRK_BackwardEuler( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 2 Stage 2nd order") { double gamma = 0.2928932188134524; #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder( + { auto s = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, gamma)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif auto s = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier, gamma)); TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); - s->setGamma(gamma); - s->initialize(); - TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 3 Stage 2nd order") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder( + { auto s = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder( + auto s = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 2 Stage 3rd order") { std::string gammaType = "3rd Order A-stable"; double gamma = 0.7886751345948128; #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder( + { auto s = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, gammaType, gamma)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif auto s = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier, gammaType, gamma)); TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); - s->setGammaType(gammaType); - s->initialize(); - TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); - s->setGamma(gamma); - s->initialize(); - TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "EDIRK 2 Stage 3rd order") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder( + { auto s = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder( + auto s = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "DIRK 1 Stage Theta Method") { double theta = 0.5; #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperDIRK_1StageTheta( + { auto s = rcp(new Tempus::StepperDIRK_1StageTheta( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess), theta); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif auto s = rcp(new Tempus::StepperDIRK_1StageTheta( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier, theta)); TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); - s->setTheta(theta); - s->initialize(); - TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "EDIRK 2 Stage Theta Method") { double theta = 0.5; #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperEDIRK_2StageTheta( + { auto s = rcp(new Tempus::StepperEDIRK_2StageTheta( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, theta)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif auto s = rcp(new Tempus::StepperEDIRK_2StageTheta( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, @@ -377,136 +328,136 @@ void testDIRKAccessorsFullConstruction(std::string stepperType) TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Trapezoidal Rule") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperEDIRK_TrapezoidalRule( + { auto s = rcp(new Tempus::StepperEDIRK_TrapezoidalRule( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperEDIRK_TrapezoidalRule( + auto s = rcp(new Tempus::StepperEDIRK_TrapezoidalRule( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Implicit Midpoint") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint( + { auto s = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint( + auto s = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SSPDIRK22") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK22( + { auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK22( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK22( + auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK22( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SSPDIRK32") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK32( + { auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK32( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK32( + auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK32( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SSPDIRK23") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK23( + { auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK23( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK23( + auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK23( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SSPDIRK33") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK33( + { auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK33( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK33( + auto s = rcp(new Tempus::StepperSDIRK_SSPDIRK33( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Implicit 1 Stage 1st order Radau IA") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA( + { auto s = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA( + auto s = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "RK Implicit 2 Stage 2nd order Lobatto IIIB") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB( + { auto s = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB( + auto s = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 5 Stage 4th order") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_5Stage4thOrder( + { auto s = rcp(new Tempus::StepperSDIRK_5Stage4thOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_5Stage4thOrder( + auto s = rcp(new Tempus::StepperSDIRK_5Stage4thOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 3 Stage 4th order") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_3Stage4thOrder( + { auto s = rcp(new Tempus::StepperSDIRK_3Stage4thOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_3Stage4thOrder( + auto s = rcp(new Tempus::StepperSDIRK_3Stage4thOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 5 Stage 5th order") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_5Stage5thOrder( + { auto s = rcp(new Tempus::StepperSDIRK_5Stage5thOrder( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_5Stage5thOrder( + auto s = rcp(new Tempus::StepperSDIRK_5Stage5thOrder( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else if (stepperType == "SDIRK 2(1) Pair") { #ifndef TEMPUS_HIDE_DEPRECATED_CODE - stepper = rcp(new Tempus::StepperSDIRK_21Pair( + { auto s = rcp(new Tempus::StepperSDIRK_21Pair( model, obs, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } #endif - stepper = rcp(new Tempus::StepperSDIRK_21Pair( + auto s = rcp(new Tempus::StepperSDIRK_21Pair( model, solver, useFSAL, ICConsistency, ICConsistencyCheck, useEmbedded, zeroInitialGuess, modifier)); - TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(!s->isInitialized()); } else TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Error - unknown stepperType = "+stepperType); } @@ -796,52 +747,15 @@ class StepperRKModifierXTest /** \brief Unit test utility for Stepper RK AppAction. */ -void testRKAppAction(std::string stepperType, - Teuchos::FancyOStream &out, bool &success) +void testRKAppAction( + const Teuchos::RCP >& stepper, + const Teuchos::RCP >& model, + Teuchos::FancyOStream &out, bool &success) { - // Default construction. - RCP > stepper; - if (stepperType == "RK Explicit 3 Stage 3rd order") stepper = rcp(new Tempus::StepperERK_3Stage3rdOrder()); - else if (stepperType == "RK Explicit 3 Stage 3rd order by Heun") stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderHeun()); - else if (stepperType == "RK Explicit 3 Stage 3rd order TVD") stepper = rcp(new Tempus::StepperERK_3Stage3rdOrderTVD()); - else if (stepperType == "RK Explicit 3/8 Rule") stepper = rcp(new Tempus::StepperERK_3_8Rule()); - else if (stepperType == "RK Explicit 4 Stage 3rd order by Runge") stepper = rcp(new Tempus::StepperERK_4Stage3rdOrderRunge()); - else if (stepperType == "RK Explicit 4 Stage") stepper = rcp(new Tempus::StepperERK_4Stage4thOrder()); - else if (stepperType == "RK Explicit 5 Stage 3rd order by Kinnmark and Gray") stepper = rcp(new Tempus::StepperERK_5Stage3rdOrderKandG()); - else if (stepperType == "Bogacki-Shampine 3(2) Pair") stepper = rcp(new Tempus::StepperERK_BogackiShampine32()); - else if (stepperType == "RK Forward Euler") stepper = rcp(new Tempus::StepperERK_ForwardEuler()); - else if (stepperType == "General ERK") stepper = rcp(new Tempus::StepperERK_General()); - else if (stepperType == "Merson 4(5) Pair") stepper = rcp(new Tempus::StepperERK_Merson45()); - else if (stepperType == "RK Explicit Midpoint") stepper = rcp(new Tempus::StepperERK_Midpoint()); - else if (stepperType == "RK Explicit Trapezoidal") stepper = rcp(new Tempus::StepperERK_Trapezoidal()); - else if (stepperType == "RK Backward Euler") stepper = rcp(new Tempus::StepperDIRK_BackwardEuler()); - else if (stepperType == "SDIRK 2 Stage 2nd order") stepper = rcp(new Tempus::StepperSDIRK_2Stage2ndOrder()); - else if (stepperType == "SDIRK 3 Stage 2nd order") stepper = rcp(new Tempus::StepperSDIRK_3Stage2ndOrder()); - else if (stepperType == "SDIRK 2 Stage 3rd order") stepper = rcp(new Tempus::StepperSDIRK_2Stage3rdOrder()); - else if (stepperType == "EDIRK 2 Stage 3rd order") stepper = rcp(new Tempus::StepperEDIRK_2Stage3rdOrder()); - else if (stepperType == "DIRK 1 Stage Theta Method") stepper = rcp(new Tempus::StepperDIRK_1StageTheta()); - else if (stepperType == "EDIRK 2 Stage Theta Method") stepper = rcp(new Tempus::StepperEDIRK_2StageTheta()); - else if (stepperType == "RK Trapezoidal Rule") stepper = rcp(new Tempus::StepperEDIRK_TrapezoidalRule()); - else if (stepperType == "RK Implicit Midpoint") stepper = rcp(new Tempus::StepperSDIRK_ImplicitMidpoint()); - else if (stepperType == "SSPDIRK22") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK22()); - else if (stepperType == "SSPDIRK32") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK32()); - else if (stepperType == "SSPDIRK23") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK23()); - else if (stepperType == "SSPDIRK33") stepper = rcp(new Tempus::StepperSDIRK_SSPDIRK33()); - else if (stepperType == "RK Implicit 1 Stage 1st order Radau IA") stepper = rcp(new Tempus::StepperDIRK_1Stage1stOrderRadauIA()); - else if (stepperType == "RK Implicit 2 Stage 2nd order Lobatto IIIB") stepper = rcp(new Tempus::StepperDIRK_2Stage2ndOrderLobattoIIIB()); - else if (stepperType == "SDIRK 5 Stage 4th order") stepper = rcp(new Tempus::StepperSDIRK_5Stage4thOrder()); - else if (stepperType == "SDIRK 3 Stage 4th order") stepper = rcp(new Tempus::StepperSDIRK_3Stage4thOrder()); - else if (stepperType == "SDIRK 5 Stage 5th order") stepper = rcp(new Tempus::StepperSDIRK_5Stage5thOrder()); - else if (stepperType == "SDIRK 2(1) Pair") stepper = rcp(new Tempus::StepperSDIRK_21Pair()); - else if (stepperType == "General DIRK") stepper = rcp(new Tempus::StepperDIRK_General()); - else TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Error - unknown stepperType = "+stepperType); - auto testTypeOrig = stepper->getStepperType(); // Test Modifier. { - Teuchos::RCP > model = - rcp(new Tempus_Test::SinCosModel()); stepper->setModel(model); auto modifier = rcp(new StepperRKModifierTest()); stepper->setAppAction(modifier); @@ -881,8 +795,6 @@ void testRKAppAction(std::string stepperType, // Test Observer. { - Teuchos::RCP > model = - rcp(new Tempus_Test::SinCosModel()); stepper->setModel(model); auto observer = rcp(new StepperRKObserverTest()); stepper->setAppAction(observer); @@ -923,8 +835,6 @@ void testRKAppAction(std::string stepperType, // Test ModifierX. { - Teuchos::RCP > model = - rcp(new Tempus_Test::SinCosModel()); stepper->setModel(model); auto modifierX = rcp(new StepperRKModifierXTest()); stepper->setAppAction(modifierX);