Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HarmonicOscillatorModel_decl.hpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef TEMPUS_TEST_HARMONIC_OSCILLATOR_MODEL_DECL_HPP
11 #define TEMPUS_TEST_HARMONIC_OSCILLATOR_MODEL_DECL_HPP
12 
13 #include "Thyra_ModelEvaluator.hpp" // Interface
14 #include "Thyra_StateFuncModelEvaluatorBase.hpp" // Implementation
15 
16 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
18 
19 namespace Tempus_Test {
20 
54 template <class Scalar>
56  : public Thyra::StateFuncModelEvaluatorBase<Scalar>,
58  public:
59  // Constructor
61  Teuchos::RCP<Teuchos::ParameterList> pList = Teuchos::null,
62  const bool use_accel_IC = false);
63 
64  // Exact solution
66 
69 
76  get_W_factory() const;
78 
82 
84 
90 
91  private:
92  void setupInOutArgs_() const;
93 
97  void evalModelImpl(
99  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs_bar) const;
101 
102  private:
110  int vecLength_; // Number of state unknowns (1)
111  int numResponses_; // Number of responses (1)
115  mutable bool isInitialized_;
116  double c_; // damping coefficient
117  double f_; // forcing coefficient
118  double k_; // coefficient multiplying x in ODE
119  double m_; // mass coefficient
121 };
122 
123 } // namespace Tempus_Test
124 #endif // TEMPUS_TEST_HARMONIC_OSCILLATOR_MODEL_DECL_HPP
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Teuchos::RCP< Thyra::VectorBase< Scalar > > p_init_
Teuchos::RCP< Thyra::VectorBase< Scalar > > x_dot_vec_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > g_space_
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > getExactSolution(double t) const
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs_bar, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs_bar) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Consider the ODE: where is a constant, is a constant damping parameter, is a constant forcing par...
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int j) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > p_space_
Teuchos::RCP< Teuchos::FancyOStream > out_
Teuchos::RCP< Thyra::VectorBase< Scalar > > x_dot_dot_vec_
Thyra::ModelEvaluatorBase::InArgs< Scalar > nominalValues_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int l) const
Teuchos::RCP< Thyra::LinearOpWithSolveBase< Scalar > > create_W() const
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > x_space_
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
HarmonicOscillatorModel(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null, const bool use_accel_IC=false)
Teuchos::RCP< Thyra::VectorBase< Scalar > > x_vec_
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs_
Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const