diff --git a/packages/tempus/src/Tempus_RKButcherTableau.hpp b/packages/tempus/src/Tempus_RKButcherTableau.hpp index c8950af3f2d1..ad2bf2cda0f5 100644 --- a/packages/tempus/src/Tempus_RKButcherTableau.hpp +++ b/packages/tempus/src/Tempus_RKButcherTableau.hpp @@ -171,6 +171,39 @@ class RKButcherTableau : } //@} + bool operator == (const RKButcherTableau & t) const { + const Scalar relTol = 1.0e-15; + if ( A_->numRows() != t.A_->numRows() || + A_->numCols() != t.A_->numCols() ) { + return false; + } else { + int i, j; + for(i = 0; i < A_->numRows(); i++) { + for(j = 0; j < A_->numCols(); j++) { + if(std::abs((t.A_(i,j) - A_(i,j))/A_(i,j)) > relTol) return false; + } + } + } + + if ( b_->length() != t.b_->length() || + b_->length() != t.c_->length() || + b_->length() != t.bstar_->length() ) { + return false; + } else { + int i; + for(i = 0; i < A_->numRows(); i++) { + if(std::abs((t.b_(i) - b_(i))/b_(i)) > relTol) return false; + if(std::abs((t.c_(i) - c_(i))/c_(i)) > relTol) return false; + if(std::abs((t.bstar_(i) - bstar_(i))/bstar_(i)) > relTol) return false; + } + } + return true; + } + + bool operator != (const RKButcherTableau & t) const { + return !((*this) == t); + } + private: RKButcherTableau(); diff --git a/packages/tempus/src/Tempus_StepperDIRK_decl.hpp b/packages/tempus/src/Tempus_StepperDIRK_decl.hpp index 588d26638213..37928615a5a9 100644 --- a/packages/tempus/src/Tempus_StepperDIRK_decl.hpp +++ b/packages/tempus/src/Tempus_StepperDIRK_decl.hpp @@ -11,7 +11,6 @@ #include "Tempus_config.hpp" #include "Tempus_StepperRKBase.hpp" -#include "Tempus_RKButcherTableau.hpp" #include "Tempus_StepperImplicit.hpp" #include "Tempus_WrapperModelEvaluator.hpp" #ifndef TEMPUS_HIDE_DEPRECATED_CODE @@ -165,9 +164,6 @@ class StepperDIRK : virtual public Tempus::StepperImplicit, virtual Teuchos::RCP > getObserver() const { return this->stepperObserver_; } #endif - virtual Teuchos::RCP > getTableau() - { return tableau_; } - /// Initialize after construction and changing input parameters. virtual void initialize(); @@ -187,14 +183,11 @@ class StepperDIRK : virtual public Tempus::StepperImplicit, /// Get a default (initial) StepperState virtual Teuchos::RCP >getDefaultStepperState(); - virtual Scalar getOrder() const{return tableau_->order();} - virtual Scalar getOrderMin() const{return tableau_->orderMin();} - virtual Scalar getOrderMax() const{return tableau_->orderMax();} virtual bool isExplicit() const { - const int numStages = tableau_->numStages(); - Teuchos::SerialDenseMatrix A = tableau_->A(); + const int numStages = this->tableau_->numStages(); + Teuchos::SerialDenseMatrix A = this->tableau_->A(); bool isExplicit = false; for (int i=0; i, /// Return alpha = d(xDot)/dx. virtual Scalar getAlpha(const Scalar dt) const { - const Teuchos::SerialDenseMatrix & A=tableau_->A(); + const Teuchos::SerialDenseMatrix & A=this->tableau_->A(); return Scalar(1.0)/(dt*A(0,0)); // Getting the first diagonal coeff! } /// Return beta = d(x)/dx. @@ -273,8 +266,6 @@ class StepperDIRK : virtual public Tempus::StepperImplicit, virtual void setupTableau() = 0; - Teuchos::RCP > tableau_; - std::vector > > stageXDot_; Teuchos::RCP > xTilde_; diff --git a/packages/tempus/src/Tempus_StepperDIRK_impl.hpp b/packages/tempus/src/Tempus_StepperDIRK_impl.hpp index ea9fc9bbcfd8..a7b09d42299e 100644 --- a/packages/tempus/src/Tempus_StepperDIRK_impl.hpp +++ b/packages/tempus/src/Tempus_StepperDIRK_impl.hpp @@ -160,7 +160,7 @@ template void StepperDIRK::initialize() { // Initialize the stage vectors - const int numStages = tableau_->numStages(); + const int numStages = this->tableau_->numStages(); this->stageX_ = this->wrapperModel_->getNominalValues().get_x()->clone_v(); stageXDot_.resize(numStages); for (int i=0; i::initialize() xTilde_ = Thyra::createMember(this->wrapperModel_->get_x_space()); assign(xTilde_.ptr(), Teuchos::ScalarTraits::zero()); - if (tableau_->isEmbedded() and this->getUseEmbedded()) { + if (this->tableau_->isEmbedded() and this->getUseEmbedded()) { ee_ = Thyra::createMember(this->wrapperModel_->get_f_space()); abs_u0 = Thyra::createMember(this->wrapperModel_->get_f_space()); abs_u = Thyra::createMember(this->wrapperModel_->get_f_space()); @@ -227,10 +227,10 @@ void StepperDIRK::takeStep( const Scalar dt = workingState->getTimeStep(); const Scalar time = currentState->getTime(); - const int numStages = tableau_->numStages(); - Teuchos::SerialDenseMatrix A = tableau_->A(); - Teuchos::SerialDenseVector b = tableau_->b(); - Teuchos::SerialDenseVector c = tableau_->c(); + const int numStages = this->tableau_->numStages(); + Teuchos::SerialDenseMatrix A = this->tableau_->A(); + Teuchos::SerialDenseVector b = this->tableau_->b(); + Teuchos::SerialDenseVector c = this->tableau_->c(); // Reset non-zero initial guess. if ( this->getResetInitialGuess() && (!this->getZeroInitialGuess()) ) @@ -253,8 +253,8 @@ void StepperDIRK::takeStep( bool isNeeded = false; for (int k=i+1; kisEmbedded() && this->getUseEmbedded() && - tableau_->bstar()(i) != 0.0) + if (this->tableau_->isEmbedded() && this->getUseEmbedded() && + this->tableau_->bstar()(i) != 0.0) isNeeded = true; if (isNeeded == false) { assign(stageXDot_[i].ptr(), Teuchos::ScalarTraits::zero()); @@ -344,14 +344,14 @@ void StepperDIRK::takeStep( } } - if (tableau_->isEmbedded() and this->getUseEmbedded()) { + if (this->tableau_->isEmbedded() and this->getUseEmbedded()) { const Scalar tolRel = workingState->getTolRel(); const Scalar tolAbs = workingState->getTolAbs(); // just compute the error weight vector // (all that is needed is the error, and not the embedded solution) Teuchos::SerialDenseVector errWght = b ; - errWght -= tableau_->bstar(); + errWght -= this->tableau_->bstar(); // compute local truncation error estimate: | u^{n+1} - \hat{u}^{n+1} | // Sum for solution: ee_n = Sum{ (b(i) - bstar(i)) * dt*f(i) } @@ -422,8 +422,8 @@ void StepperDIRK::describe( StepperImplicit::describe(out, verbLevel); out << "--- StepperDIRK ---\n"; - out << " tableau_ = " << tableau_ << std::endl; - if (tableau_ != Teuchos::null) tableau_->describe(out, verbLevel); + out << " tableau_ = " << this->tableau_ << std::endl; + if (this->tableau_ != Teuchos::null) this->tableau_->describe(out, verbLevel); #ifndef TEMPUS_HIDE_DEPRECATED_CODE out << " stepperObserver_ = " << stepperObserver_ << std::endl; #endif @@ -452,7 +452,7 @@ bool StepperDIRK::isValidSetup(Teuchos::FancyOStream & out) const if ( !Stepper::isValidSetup(out) ) isValidSetup = false; if ( !StepperImplicit::isValidSetup(out) ) isValidSetup = false; - if (tableau_ == Teuchos::null) { + if (this->tableau_ == Teuchos::null) { isValidSetup = false; out << "The tableau is not set!\n"; } diff --git a/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp b/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp index 58c5c832290d..a5c12f587f1a 100644 --- a/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp +++ b/packages/tempus/src/Tempus_StepperExplicitRK_decl.hpp @@ -12,7 +12,6 @@ #include "Tempus_config.hpp" #include "Tempus_StepperRKBase.hpp" #include "Tempus_StepperExplicit.hpp" -#include "Tempus_RKButcherTableau.hpp" #ifndef TEMPUS_HIDE_DEPRECATED_CODE #include "Tempus_StepperRKObserverComposite.hpp" #endif @@ -111,9 +110,6 @@ class StepperExplicitRK : virtual public Tempus::StepperExplicit, virtual Teuchos::RCP > getObserver() const { return this->stepperObserver_; } #endif - virtual Teuchos::RCP > getTableau() - { return tableau_; } - /// Initialize during construction and after changing input parameters. virtual void initialize(); @@ -127,9 +123,6 @@ class StepperExplicitRK : virtual public Tempus::StepperExplicit, /// Get a default (initial) StepperState virtual Teuchos::RCP > getDefaultStepperState(); - virtual Scalar getOrder() const {return tableau_->order();} - virtual Scalar getOrderMin() const {return tableau_->orderMin();} - virtual Scalar getOrderMax() const {return tableau_->orderMax();} virtual Scalar getInitTimeStep( const Teuchos::RCP >& solutionHistory) const; @@ -191,8 +184,6 @@ class StepperExplicitRK : virtual public Tempus::StepperExplicit, virtual void setupTableau() = 0; - Teuchos::RCP > tableau_; - std::vector > > stageXDot_; #ifndef TEMPUS_HIDE_DEPRECATED_CODE diff --git a/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp b/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp index 74294b5d9660..9ebe0b8c9d6b 100644 --- a/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp +++ b/packages/tempus/src/Tempus_StepperExplicitRK_impl.hpp @@ -222,7 +222,7 @@ void StepperExplicitRK::setObserver( template void StepperExplicitRK::initialize() { - TEUCHOS_TEST_FOR_EXCEPTION( tableau_ == Teuchos::null, std::logic_error, + TEUCHOS_TEST_FOR_EXCEPTION( this->tableau_ == Teuchos::null, std::logic_error, "Error - Need to set the tableau, before calling " "StepperExplicitRK::initialize()\n"); @@ -231,14 +231,14 @@ void StepperExplicitRK::initialize() "StepperExplicitRK::initialize()\n"); // Initialize the stage vectors - int numStages = tableau_->numStages(); + int numStages = this->tableau_->numStages(); stageXDot_.resize(numStages); for (int i=0; iappModel_->get_f_space()); assign(stageXDot_[i].ptr(), Teuchos::ScalarTraits::zero()); } - if ( tableau_->isEmbedded() and this->getUseEmbedded() ){ + if ( this->tableau_->isEmbedded() and this->getUseEmbedded() ){ ee_ = Thyra::createMember(this->appModel_->get_f_space()); abs_u0 = Thyra::createMember(this->appModel_->get_f_space()); abs_u = Thyra::createMember(this->appModel_->get_f_space()); @@ -295,10 +295,10 @@ void StepperExplicitRK::takeStep( const Scalar dt = workingState->getTimeStep(); const Scalar time = currentState->getTime(); - const int numStages = tableau_->numStages(); - Teuchos::SerialDenseMatrix A = tableau_->A(); - Teuchos::SerialDenseVector b = tableau_->b(); - Teuchos::SerialDenseVector c = tableau_->c(); + const int numStages = this->tableau_->numStages(); + Teuchos::SerialDenseMatrix A = this->tableau_->A(); + Teuchos::SerialDenseVector b = this->tableau_->b(); + Teuchos::SerialDenseVector c = this->tableau_->c(); this->stageX_ = workingState->getX(); Thyra::assign(this->stageX_.ptr(), *(currentState->getX())); @@ -376,7 +376,7 @@ void StepperExplicitRK::takeStep( // can change the step status workingState->setSolutionStatus(Status::PASSED); - if (tableau_->isEmbedded() and this->getUseEmbedded()) { + if (this->tableau_->isEmbedded() and this->getUseEmbedded()) { const Scalar tolRel = workingState->getTolRel(); const Scalar tolAbs = workingState->getTolAbs(); @@ -384,7 +384,7 @@ void StepperExplicitRK::takeStep( // just compute the error weight vector // (all that is needed is the error, and not the embedded solution) Teuchos::SerialDenseVector errWght = b ; - errWght -= tableau_->bstar(); + errWght -= this->tableau_->bstar(); //compute local truncation error estimate: | u^{n+1} - \hat{u}^{n+1} | // Sum for solution: ee_n = Sum{ (b(i) - bstar(i)) * dt*f(i) } @@ -452,8 +452,8 @@ void StepperExplicitRK::describe( StepperExplicit::describe(out, verbLevel); out << "--- StepperExplicitRK ---\n"; - if (tableau_ != Teuchos::null) tableau_->describe(out, verbLevel); - out << " tableau_ = " << tableau_ << std::endl; + if (this->tableau_ != Teuchos::null) this->tableau_->describe(out, verbLevel); + out << " tableau_ = " << this->tableau_ << std::endl; #ifndef TEMPUS_HIDE_DEPRECATED_CODE out << " stepperObserver_ = " << stepperObserver_ << std::endl; #endif @@ -481,7 +481,7 @@ bool StepperExplicitRK::isValidSetup(Teuchos::FancyOStream & out) const if ( !Stepper::isValidSetup(out) ) isValidSetup = false; if ( !StepperExplicit::isValidSetup(out) ) isValidSetup = false; - if (tableau_ == Teuchos::null) { + if (this->tableau_ == Teuchos::null) { isValidSetup = false; out << "The tableau is not set!\n"; } diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp index 8a9b1c2e8c44..f76d789a72ec 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_Partition_decl.hpp @@ -356,15 +356,27 @@ class StepperIMEX_RK_Partition : virtual public Tempus::StepperImplicit, /// \name Basic stepper methods //@{ + /// Returns the explicit tableau! + virtual Teuchos::RCP > getTableau() const + { return getExplicitTableau(); } + /// Set both the explicit and implicit tableau from ParameterList virtual void setTableaus(std::string stepperType = "", Teuchos::RCP > explicitTableau = Teuchos::null, Teuchos::RCP > implicitTableau = Teuchos::null); + /// Return explicit tableau. + virtual Teuchos::RCP > getExplicitTableau() const + { return explicitTableau_; } + /// Set the explicit tableau from tableau virtual void setExplicitTableau( Teuchos::RCP > explicitTableau); + /// Return implicit tableau. + virtual Teuchos::RCP > getImplicitTableau() const + { return implicitTableau_; } + /// Set the implicit tableau from tableau virtual void setImplicitTableau( Teuchos::RCP > implicitTableau); @@ -417,7 +429,10 @@ class StepperIMEX_RK_Partition : virtual public Tempus::StepperImplicit, virtual OrderODE getOrderODE() const {return FIRST_ORDER_ODE;} //@} - Teuchos::RCP >& getStageZ() {return stageZ_;}; + /// Return the full stage solution which is Z (the concat of X and Y) for IMEX Partition. + Teuchos::RCP > getStageX() {return stageZ_;} + /// Explicitly return the full stage solution, Z. + Teuchos::RCP > getStageZ() {return stageZ_;}; std::vector > >& getStageF() {return stageF_;}; std::vector > >& getStageGx() {return stageGx_;}; Teuchos::RCP >& getXTilde() {return xTilde_;}; diff --git a/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp b/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp index 2ac4c7c64200..2e1808ace6a9 100644 --- a/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp +++ b/packages/tempus/src/Tempus_StepperIMEX_RK_decl.hpp @@ -326,15 +326,27 @@ class StepperIMEX_RK : virtual public Tempus::StepperImplicit, /// \name Basic stepper methods //@{ + /// Returns the explicit tableau! + virtual Teuchos::RCP > getTableau() const + { return getExplicitTableau(); } + /// Set both the explicit and implicit tableau from ParameterList virtual void setTableaus( std::string stepperType = "", Teuchos::RCP > explicitTableau = Teuchos::null, Teuchos::RCP > implicitTableau = Teuchos::null); + /// Return explicit tableau. + virtual Teuchos::RCP > getExplicitTableau() const + { return explicitTableau_; } + /// Set the explicit tableau from tableau virtual void setExplicitTableau( Teuchos::RCP > explicitTableau); + /// Return implicit tableau. + virtual Teuchos::RCP > getImplicitTableau() const + { return implicitTableau_; } + /// Set the implicit tableau from tableau virtual void setImplicitTableau( Teuchos::RCP > implicitTableau); diff --git a/packages/tempus/src/Tempus_StepperRKAppActionComposite.hpp b/packages/tempus/src/Tempus_StepperRKAppActionComposite.hpp index d3f81bbfce06..4841faa17e1a 100644 --- a/packages/tempus/src/Tempus_StepperRKAppActionComposite.hpp +++ b/packages/tempus/src/Tempus_StepperRKAppActionComposite.hpp @@ -10,7 +10,6 @@ #define Tempus_StepperRKAppActionComposite_hpp #include "Tempus_StepperRKAppAction.hpp" -#include "Tempus_TimeStepControl.hpp" #include namespace Tempus { @@ -27,15 +26,15 @@ class StepperRKAppActionComposite public: /// Default constructor - StepperRKAppActionComposite(); + StepperRKAppActionComposite() {} /// Destructor - virtual ~StepperRKAppActionComposite(); + virtual ~StepperRKAppActionComposite() {} /// Execute application action for RK Stepper. virtual void execute( Teuchos::RCP > sh, - Teuchos::RCP > stepper, + Teuchos::RCP > stepper, const typename StepperRKAppAction::ACTION_LOCATION actLoc) { for(auto& a : appActions_) @@ -43,13 +42,13 @@ class StepperRKAppActionComposite } // Add AppAction to the AppAction vector. - void addRKAppAction(Teuchos::RCP > appAction); + void addRKAppAction(Teuchos::RCP > appAction) { appActions_.push_back(appAction); } // Clear the AppAction vector. - void clearRKAppActions(); + void clearRKAppActions() { appActions_.clear(); } // Return the size of the AppAction vector. diff --git a/packages/tempus/src/Tempus_StepperRKBase.hpp b/packages/tempus/src/Tempus_StepperRKBase.hpp index 3f15bec1e81a..832c55e714ea 100644 --- a/packages/tempus/src/Tempus_StepperRKBase.hpp +++ b/packages/tempus/src/Tempus_StepperRKBase.hpp @@ -12,6 +12,7 @@ #include "Thyra_VectorBase.hpp" #include "Tempus_Stepper.hpp" +#include "Tempus_RKButcherTableau.hpp" #include "Tempus_StepperRKAppAction.hpp" #include "Tempus_StepperRKModifierDefault.hpp" @@ -30,11 +31,19 @@ class StepperRKBase : virtual public Tempus::Stepper public: - virtual int getStageNumber() const { return stageNumber_; } + virtual Teuchos::RCP > getTableau() const + { return tableau_; } + + virtual Scalar getOrder() const{return getTableau()->order();} + virtual Scalar getOrderMin() const{return getTableau()->orderMin();} + virtual Scalar getOrderMax() const{return getTableau()->orderMax();} + virtual int getNumberOfStages() const {return getTableau()->numStages();} + virtual int getStageNumber() const { return stageNumber_; } virtual void setStageNumber(int s) { stageNumber_ = s; } virtual Teuchos::RCP > getStageX() {return stageX_;} + virtual Teuchos::RCP > getStageX() const {return stageX_;} virtual void setAppAction(Teuchos::RCP > appAction) { @@ -53,7 +62,10 @@ class StepperRKBase : virtual public Tempus::Stepper protected: - int stageNumber_; //< The Runge-Kutta stage number, {0,...,s-1}. + Teuchos::RCP > tableau_; + + /// The current Runge-Kutta stage number, {0,...,s-1}. -1 indicates outside stage loop. + int stageNumber_; Teuchos::RCP > stageX_; Teuchos::RCP > stepperRKAppAction_; diff --git a/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp b/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp index f33e97f7f3ad..aa2d2b4b02bb 100644 --- a/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp +++ b/packages/tempus/src/Tempus_StepperRKButcherTableau.hpp @@ -4055,7 +4055,7 @@ class StepperSDIRK_5Stage4thOrder : << " [ 371/1360 -137/2720 15/544 1/4 ]\n" << " [ 25/24 -49/48 125/16 -85/12 1/4 ]\n" << "b = [ 25/24 -49/48 125/16 -85/12 1/4 ]'"; - //<< "b = [ 59/48 -17/96 225/32 -85/12 0 ]'"; + // << "b = [ 59/48 -17/96 225/32 -85/12 0 ]'"; return Description.str(); } diff --git a/packages/tempus/src/Tempus_StepperRKModifierXBase.hpp b/packages/tempus/src/Tempus_StepperRKModifierXBase.hpp index 6e3e15aa23a7..961daf45bee6 100644 --- a/packages/tempus/src/Tempus_StepperRKModifierXBase.hpp +++ b/packages/tempus/src/Tempus_StepperRKModifierXBase.hpp @@ -75,6 +75,7 @@ class StepperRKModifierXBase RCP > workingState = sh->getWorkingState(); const Scalar time = workingState->getTime(); const Scalar dt = workingState->getTimeStep(); + const int stageNumber = stepper->getStageNumber(); RCP > x; switch(actLoc) { @@ -105,13 +106,13 @@ class StepperRKModifierXBase case StepperRKAppAction::BEFORE_EXPLICIT_EVAL: { modType = X_BEFORE_EXPLICIT_EVAL; - x = workingState->getX(); + x = stepper->getStageX(); break; } case StepperRKAppAction::END_STAGE: { - modType = XDOT_END_STAGE; - x = stepper->getStepperXDot(workingState); + modType = X_END_STAGE; + x = stepper->getStageX(); break; } case StepperRKAppAction::END_STEP: @@ -125,7 +126,7 @@ class StepperRKModifierXBase "Error - unknown action location.\n"); } - this->modify(x, time, dt, modType); + this->modify(x, time, dt, stageNumber, modType); } public: @@ -137,7 +138,7 @@ class StepperRKModifierXBase X_BEFORE_SOLVE, ///< Modify \f$x\f$ before the implicit solve. X_AFTER_SOLVE, ///< Modify \f$x\f$ after the implicit solve. X_BEFORE_EXPLICIT_EVAL, ///< Modify \f$x\f$ before the explicit evaluation. - XDOT_END_STAGE, ///< Modify \f$\dot{x}\f$ at the end of the stage. + X_END_STAGE, ///< Modify \f$x\f$ at the end of the stage. X_END_STEP ///< Modify \f$x\f$ at the end of the step. }; @@ -145,6 +146,7 @@ class StepperRKModifierXBase virtual void modify( Teuchos::RCP > /* x */, const Scalar /* time */, const Scalar /* dt */, + const int /* stageNumber */, const MODIFIER_TYPE modType) = 0; }; diff --git a/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp b/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp index a06fef3578a5..b40591b4daff 100644 --- a/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp +++ b/packages/tempus/src/Tempus_StepperRKModifierXDefault.hpp @@ -39,6 +39,7 @@ class StepperRKModifierXDefault virtual void modify( Teuchos::RCP > /* x */, const Scalar /* time */, const Scalar /* dt */, + const int /* stageNumber */, const typename StepperRKModifierXBase::MODIFIER_TYPE modType) { switch(modType) { @@ -47,7 +48,7 @@ class StepperRKModifierXDefault case StepperRKModifierXBase::X_BEFORE_SOLVE: case StepperRKModifierXBase::X_AFTER_SOLVE: case StepperRKModifierXBase::X_BEFORE_EXPLICIT_EVAL: - case StepperRKModifierXBase::XDOT_END_STAGE: + case StepperRKModifierXBase::X_END_STAGE: case StepperRKModifierXBase::X_END_STEP: { // No-op. diff --git a/packages/tempus/src/Tempus_Stepper_decl.hpp b/packages/tempus/src/Tempus_Stepper_decl.hpp index 303f56452094..7d943bbca245 100644 --- a/packages/tempus/src/Tempus_Stepper_decl.hpp +++ b/packages/tempus/src/Tempus_Stepper_decl.hpp @@ -185,10 +185,10 @@ class Stepper private: - std::string stepperType_; //< Name of stepper type - bool useFSAL_ = false; //< Use First-Step-As-Last (FSAL) principle - std::string ICConsistency_ = std::string("None"); //< Type of consistency to apply to ICs. - bool ICConsistencyCheck_ = true; //< Check if the initial condition is consistent + std::string stepperType_; ///< Name of stepper type + bool useFSAL_ = false; ///< Use First-Step-As-Last (FSAL) principle + std::string ICConsistency_ = std::string("None"); ///< Type of consistency to apply to ICs. + bool ICConsistencyCheck_ = true; ///< Check if the initial condition is consistent // RCP to SolutionState memory or Stepper temporary memory (if needed). Teuchos::RCP > stepperX_; @@ -209,7 +209,7 @@ class Stepper virtual void setStepperXDotDot(Teuchos::RCP > xDotDot) { stepperXDotDot_ = xDotDot; } - bool isInitialized_ = false; //< True if stepper's member data is initialized. + bool isInitialized_ = false; ///< True if stepper's member data is initialized. }; diff --git a/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_decl.hpp b/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_decl.hpp index 1732dd416a43..e521c0020abd 100644 --- a/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_decl.hpp +++ b/packages/tempus/src/Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_decl.hpp @@ -184,8 +184,8 @@ class WrapperModelEvaluatorPairPartIMEX_Basic Thyra::ModelEvaluatorBase::OutArgs wrapperImplicitOutArgs_; int numExplicitOnlyBlocks_; - int parameterIndex_; //< implicit parameter index for explicit-only vector - bool useImplicitModel_; //< if true, use implicitModel_ else explicitModel_ + int parameterIndex_; ///< implicit parameter index for explicit-only vector + bool useImplicitModel_; ///< if true, use implicitModel_ else explicitModel_ }; } // namespace Tempus diff --git a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp index 0b0fb70fa681..e419cb42ea66 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK.cpp @@ -92,6 +92,9 @@ TEUCHOS_UNIT_TEST(IMEX_RK, Default_Construction) stepper->setImplicitTableau(implicitTableau); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setOrder(order); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(explicitTableau != stepper->getTableau()); + TEUCHOS_TEST_FOR_EXCEPT(explicitTableau != stepper->getExplicitTableau()); + TEUCHOS_TEST_FOR_EXCEPT(implicitTableau != stepper->getImplicitTableau()); // Full argument list construction. #ifndef TEMPUS_HIDE_DEPRECATED_CODE 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 cf7d173510bf..6b1961e28f65 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_IMEX_RK_Partition.cpp @@ -99,6 +99,9 @@ TEUCHOS_UNIT_TEST(IMEX_RK_Partition, Default_Construction) stepper->setImplicitTableau(implicitTableau); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); stepper->setOrder(order); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + TEUCHOS_TEST_FOR_EXCEPT(explicitTableau != stepper->getTableau()); + TEUCHOS_TEST_FOR_EXCEPT(explicitTableau != stepper->getExplicitTableau()); + TEUCHOS_TEST_FOR_EXCEPT(implicitTableau != stepper->getImplicitTableau()); // Full argument list construction. #ifndef TEMPUS_HIDE_DEPRECATED_CODE diff --git a/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp b/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp index 89e7d3afad96..7327a6145e6f 100644 --- a/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp +++ b/packages/tempus/unit_test/Tempus_UnitTest_Utils.hpp @@ -17,6 +17,7 @@ #include "Tempus_StepperRKModifierDefault.hpp" #include "Tempus_StepperRKModifierXDefault.hpp" #include "Tempus_StepperRKObserverDefault.hpp" +#include "Tempus_StepperRKAppActionComposite.hpp" #include "../TestModels/SinCosModel.hpp" #include "../TestModels/VanDerPolModel.hpp" @@ -509,6 +510,8 @@ class StepperRKModifierTest testBEGIN_STEP = true; auto x = sh->getCurrentState()->getX(); testCurrentValue = get_ele(*(x), 0); + testType = stepper->getStepperType() + " - Modifier"; + stepper->setStepperType(testType); break; } case StepperRKAppAction::BEGIN_STAGE: @@ -520,18 +523,11 @@ class StepperRKModifierTest { testBEFORE_SOLVE = true; testDt = sh->getWorkingState()->getTimeStep()/10.0; - sh->getWorkingState()->setTimeStep(testDt); break; } case StepperRKAppAction::AFTER_SOLVE: { testAFTER_SOLVE = true; - static bool done_once = false; - if (!done_once) { - testType = stepper->getStepperType() + " - Modifier"; - done_once = true; - } - stepper->setStepperType(testType); break; } case StepperRKAppAction::BEFORE_EXPLICIT_EVAL: @@ -619,13 +615,12 @@ class StepperRKObserverTest { testBEFORE_SOLVE = true; testDt = sh->getWorkingState()->getTimeStep()/10.0; - sh->getWorkingState()->setTimeStep(testDt); break; } case StepperRKAppAction::AFTER_SOLVE: { testAFTER_SOLVE = true; - testType = stepper->getStepperType(); + testType = stepper->getStepperType() + " - Observer"; break; } case StepperRKAppAction::BEFORE_EXPLICIT_EVAL: @@ -680,9 +675,11 @@ class StepperRKModifierXTest testXDOT_END_STAGE(false), testX_END_STEP(false), testX(-0.99), - testXDot(-0.99), + testEndStageX(-0.99), testDt(-1.5), - testTime(-1.5) + testTime(-1.5), + testStageNumber(-1), + testStageX(-0.99) {} /// Destructor @@ -692,6 +689,7 @@ class StepperRKModifierXTest virtual void modify( Teuchos::RCP > x, const double time, const double dt, + const int stageNumber, const typename Tempus::StepperRKModifierXBase::MODIFIER_TYPE modType) { switch(modType) { @@ -721,12 +719,14 @@ class StepperRKModifierXTest case StepperRKModifierXBase::X_BEFORE_EXPLICIT_EVAL: { testX_BEFORE_EXPLICIT_EVAL = true; + testStageNumber = stageNumber; + testStageX = get_ele(*(x), 0); // x should be the stage value. break; } - case StepperRKModifierXBase::XDOT_END_STAGE: + case StepperRKModifierXBase::X_END_STAGE: { testXDOT_END_STAGE = true; - testXDot = get_ele(*(x), 0); + testEndStageX = get_ele(*(x), 0); break; } case StepperRKModifierXBase::X_END_STEP: @@ -748,9 +748,11 @@ class StepperRKModifierXTest bool testXDOT_END_STAGE; bool testX_END_STEP; double testX; - double testXDot; + double testEndStageX; double testDt; double testTime; + int testStageNumber; + double testStageX; }; @@ -797,7 +799,7 @@ void testRKAppAction( x = solutionHistory->getWorkingState()->getX(); TEST_FLOATING_EQUALITY(modifier->testWorkingValue,get_ele(*(x), 0),1.0e-15); auto Dt = solutionHistory->getWorkingState()->getTimeStep(); - TEST_FLOATING_EQUALITY(modifier->testDt, Dt, 1.0e-15); + TEST_FLOATING_EQUALITY(modifier->testDt, Dt/10.0, 1.0e-15); TEST_COMPARE(modifier->testType, ==, testType); } @@ -810,7 +812,6 @@ void testRKAppAction( stepper->setStepperType(testTypeOrig); stepper->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); - auto testType = testTypeOrig; // Create a SolutionHistory. auto solutionHistory = Tempus::createSolutionHistoryME(model); @@ -837,8 +838,9 @@ void testRKAppAction( x = solutionHistory->getWorkingState()->getX(); TEST_FLOATING_EQUALITY(observer->testWorkingValue,get_ele(*(x), 0),1.0e-15); auto Dt = solutionHistory->getWorkingState()->getTimeStep(); - TEST_FLOATING_EQUALITY(observer->testDt, Dt, 1.0e-15); + TEST_FLOATING_EQUALITY(observer->testDt, Dt/10.0, 1.0e-15); + auto testType = testTypeOrig + " - Observer"; TEST_COMPARE(observer->testType, ==, testType); } @@ -873,14 +875,225 @@ void testRKAppAction( // Testing that values can be set through the modifierX. auto x = solutionHistory->getCurrentState()->getX(); TEST_FLOATING_EQUALITY(modifierX->testX, get_ele(*(x), 0), 1.0e-15); - // Temporary memory for xDot is not guarranteed to exist outside the Stepper - auto xDot = stepper->getStepperXDot(solutionHistory->getWorkingState()); - TEST_FLOATING_EQUALITY(modifierX->testXDot, get_ele(*(xDot), 0),1.0e-15); auto Dt = solutionHistory->getWorkingState()->getTimeStep(); TEST_FLOATING_EQUALITY(modifierX->testDt, Dt, 1.0e-15); auto time = solutionHistory->getWorkingState()->getTime(); TEST_FLOATING_EQUALITY(modifierX->testTime, time, 1.0e-15); + + // Stage Number should be -1 outside stage loop. + TEST_COMPARE(stepper->getStageNumber(), ==, -1); + // The last stage number through X_BEFORE_EXPLICIT_EVAL should be + // the number of stages minus one. + TEST_COMPARE(modifierX->testStageNumber,==,stepper->getNumberOfStages()-1); + + if (rcp_dynamic_cast>(stepper) != Teuchos::null || + rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 2.0, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 2.0,1.0e-15); + } else if (stepper->isImplicit()) { + // For implicit steppers, stageX is separate memory which can be tested. + auto stageX = stepper->getStageX(); + TEST_FLOATING_EQUALITY(modifierX->testStageX, get_ele(*(stageX), 0),1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, get_ele(*(stageX), 0),1.0e-15); + } else { + // For explicit steppers, stageX is under written and not available + // outside takeStep, so direct comparisons are needed. + if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09966666666666668, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09966666666666668, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.1, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.1, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.06666666666666667, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.06666666666666667, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.05, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.05, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09950000000000001, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09950000000000001, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09975000000000001, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09975000000000001, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.06662222222222222, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.06662222222222222, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09983333333333333, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09983333333333333, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.0, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.0, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09975000000000001, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09975000000000001, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09983333333333332, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09983333333333332, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.05, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.05, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.1, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.1, 1.0e-15); + } else { + TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, + "Error - unknown stepperType = "+stepper->getStepperType()); + } + } + } + + + // Test Composite. + { + stepper->setModel(model); + + auto modifier = rcp(new StepperRKModifierTest()); + auto observer = rcp(new StepperRKObserverTest()); + auto modifierX = rcp(new StepperRKModifierXTest()); + auto composite = rcp(new Tempus::StepperRKAppActionComposite()); + + composite->addRKAppAction(modifier); + composite->addRKAppAction(observer); + composite->addRKAppAction(modifierX); + stepper->setAppAction(composite); + + stepper->initialize(); + TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized()); + + // Create a SolutionHistory. + auto solutionHistory = Tempus::createSolutionHistoryME(model); + + // Take one time step. + stepper->setInitialConditions(solutionHistory); + solutionHistory->initWorkingState(); + double dt = 0.1; + solutionHistory->getWorkingState()->setTimeStep(dt); + stepper->takeStep(solutionHistory); + + auto xCS = solutionHistory->getCurrentState()->getX(); + auto xWS = solutionHistory->getWorkingState()->getX(); + auto Dt = solutionHistory->getWorkingState()->getTimeStep(); + + // Test Modifier. + // Testing that each ACTION_LOCATION has been called. + TEST_COMPARE(modifier->testBEGIN_STEP, ==, true); + TEST_COMPARE(modifier->testBEGIN_STAGE, ==, true); + TEST_COMPARE(modifier->testBEFORE_SOLVE, ==, true); + TEST_COMPARE(modifier->testAFTER_SOLVE, ==, true); + TEST_COMPARE(modifier->testBEFORE_EXPLICIT_EVAL, ==, true); + TEST_COMPARE(modifier->testEND_STAGE, ==, true); + TEST_COMPARE(modifier->testEND_STEP, ==, true); + + // Testing that values can be set through the modifier. + TEST_FLOATING_EQUALITY(modifier->testCurrentValue, get_ele(*(xCS), 0),1.0e-15); + TEST_FLOATING_EQUALITY(modifier->testWorkingValue, get_ele(*(xWS), 0),1.0e-15); + TEST_FLOATING_EQUALITY(modifier->testDt, Dt/10.0, 1.0e-15); + + auto testType = testTypeOrig + " - Modifier"; + TEST_COMPARE(modifier->testType, ==, testType); + + + // Test Observer. + // Testing that each ACTION_LOCATION has been called. + TEST_COMPARE(observer->testBEGIN_STEP, ==, true); + TEST_COMPARE(observer->testBEGIN_STAGE, ==, true); + TEST_COMPARE(observer->testBEFORE_SOLVE, ==, true); + TEST_COMPARE(observer->testAFTER_SOLVE, ==, true); + TEST_COMPARE(observer->testBEFORE_EXPLICIT_EVAL, ==, true); + TEST_COMPARE(observer->testEND_STAGE, ==, true); + TEST_COMPARE(observer->testEND_STEP, ==, true); + + // Testing that values can be observed through the observer. + TEST_FLOATING_EQUALITY(observer->testCurrentValue, get_ele(*(xCS), 0),1.0e-15); + TEST_FLOATING_EQUALITY(observer->testWorkingValue, get_ele(*(xWS), 0),1.0e-15); + TEST_FLOATING_EQUALITY(observer->testDt, Dt/10.0, 1.0e-15); + + testType = testType + " - Observer"; + TEST_COMPARE(observer->testType, ==, testType); + + + // Test ModifierX. + // Testing that each ACTION_LOCATION has been called. + TEST_COMPARE(modifierX->testX_BEGIN_STEP, ==, true); + TEST_COMPARE(modifierX->testX_BEGIN_STAGE, ==, true); + TEST_COMPARE(modifierX->testX_BEFORE_SOLVE, ==, true); + TEST_COMPARE(modifierX->testX_AFTER_SOLVE, ==, true); + TEST_COMPARE(modifierX->testX_BEFORE_EXPLICIT_EVAL, ==, true); + TEST_COMPARE(modifierX->testXDOT_END_STAGE, ==, true); + TEST_COMPARE(modifierX->testX_END_STEP, ==, true); + + // Testing that values can be set through the modifierX. + TEST_FLOATING_EQUALITY(modifierX->testX, get_ele(*(xCS), 0), 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testDt, Dt, 1.0e-15); + + auto time = solutionHistory->getWorkingState()->getTime(); + TEST_FLOATING_EQUALITY(modifierX->testTime, time, 1.0e-15); + + // Stage Number should be -1 outside stage loop. + TEST_COMPARE(stepper->getStageNumber(), ==, -1); + // The last stage number through X_BEFORE_EXPLICIT_EVAL should be + // the number of stages minus one. + TEST_COMPARE(modifierX->testStageNumber,==,stepper->getNumberOfStages()-1); + + if (rcp_dynamic_cast>(stepper) != Teuchos::null || + rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 2.0, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 2.0,1.0e-15); + } else if (stepper->isImplicit()) { + // For implicit steppers, stageX is separate memory which can be tested. + auto stageX = stepper->getStageX(); + TEST_FLOATING_EQUALITY(modifierX->testStageX, get_ele(*(stageX), 0),1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, get_ele(*(stageX), 0),1.0e-15); + } else { + // For explicit steppers, stageX is under written and not available + // outside takeStep, so direct comparisons are needed. + if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09966666666666668, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09966666666666668, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.1, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.1, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.06666666666666667, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.06666666666666667, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.05, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.05, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09950000000000001, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09950000000000001, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09975000000000001, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09975000000000001, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.06662222222222222, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.06662222222222222, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09983333333333333, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09983333333333333, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.0, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.0, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09975000000000001, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09975000000000001, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.09983333333333332, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.09983333333333332, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.05, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.05, 1.0e-15); + } else if (rcp_dynamic_cast>(stepper) != Teuchos::null) { + TEST_FLOATING_EQUALITY(modifierX->testStageX, 0.1, 1.0e-15); + TEST_FLOATING_EQUALITY(modifierX->testEndStageX, 0.1, 1.0e-15); + } else { + TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, + "Error - unknown stepperType = "+stepper->getStepperType()); + } + } } }