Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SinCosModel_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef TEMPUS_TEST_SINCOS_MODEL_DECL_HPP
10 #define TEMPUS_TEST_SINCOS_MODEL_DECL_HPP
11 
12 #include "Thyra_ModelEvaluator.hpp" // Interface
13 #include "Thyra_StateFuncModelEvaluatorBase.hpp" // Implementation
14 
15 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
17 
18 namespace Tempus_Test {
19 
107 template <class Scalar>
110  public:
111  // Constructor
112  SinCosModel(Teuchos::RCP<Teuchos::ParameterList> pList = Teuchos::null);
113 
114  // Exact solution
116 
117  // Exact sensitivity solution
119  int j, double t) const;
120 
123 
130  get_W_factory() const;
132 
136 
138 
144 
145  private:
146  void setupInOutArgs_() const;
147 
151  void evalModelImpl(
153  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs_bar) const;
155 
156  void calculateCoeffFromIC_();
157 
158  protected:
159  int dim_;
160  int Np_;
161  int np_;
162  int Ng_;
163  int ng_;
164  bool haveIC_;
167  mutable bool isInitialized_;
176 
177  // Parameters for the model: x_0(t) = a + b*sin(f*t+phi)
178  // x_1(t) = b*f*cos(f*t+phi)
179  Scalar a_;
180  Scalar f_;
181  Scalar L_;
182  Scalar phi_;
183  Scalar b_;
184  Scalar t0_ic_;
185  Scalar x0_ic_;
186  Scalar x1_ic_;
187 };
188 
190 // Teuchos::RCP<SinCosModel> sineCosineModel(
191 // Teuchos::RCP<Teuchos::ParameterList> pList_)
192 //{
193 // Teuchos::RCP<SinCosModel> model = rcp(new SinCosModel(pList_));
194 // return(model);
195 // }
196 
198 
202 template <class Scalar>
203 class SinCosModelAdjoint : public SinCosModel<Scalar> {
204  public:
205  // Constructor
207  : SinCosModel<Scalar>(pList)
208  {
209  }
210 
213 
217 
219 
220  private:
224  void evalModelImpl(
226  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs_bar) const;
228 };
229 
230 } // namespace Tempus_Test
231 #endif // TEMPUS_TEST_SINCOS_MODEL_DECL_HPP
Scalar b_
Parameter determined from the IC.
Scalar L_
Model parameter.
int Ng_
Number of observation functions (1)
int ng_
Number of elements in this observation function (1)
Thyra::ModelEvaluatorBase::InArgs< Scalar > nominalValues_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > DxDp_space_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > p_space_
Scalar f_
Model parameter.
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
bool useDfDpAsTangent_
Treat DfDp OutArg as tangent (df/dx*dx/dp+df/dp)
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > f_space_
Sine-Cosine model problem from Rythmos. This is a canonical Sine-Cosine differential equation with a...
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
int dim_
Number of state unknowns (2)
int Np_
Number of parameter vectors (1)
Teuchos::RCP< Thyra::LinearOpWithSolveBase< Scalar > > create_W() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
bool haveIC_
false =&gt; no nominal values are provided (default=true)
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs_
bool acceptModelParams_
Changes inArgs to require parameters.
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs_bar, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs_bar) const
Scalar t0_ic_
Time value where the initial condition is specified.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > getExactSolution(double t) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs_
SinCosModel(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
int np_
Number of parameters in this vector (2)
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int l) const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > g_space_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs_bar, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs_bar) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > x_space_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int j) const
Scalar x1_ic_
Initial condition for x1.
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Scalar phi_
Parameter determined from the IC.
Thyra::ModelEvaluatorBase::InArgs< Scalar > getExactSensSolution(int j, double t) const
Scalar x0_ic_
Initial condition for x0.
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Scalar a_
Model parameter.
Teuchos::RCP< Thyra::LinearOpWithSolveBase< Scalar > > create_W() const
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
SinCosModelAdjoint(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)