Tempus  Version of the Day
Time Integration
DahlquistTestModel_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_DAHLQUIST_TEST_MODEL_DECL_HPP
10 #define TEMPUS_TEST_DAHLQUIST_TEST_MODEL_DECL_HPP
11 
12 #include "Thyra_ModelEvaluator.hpp" // Interface
13 #include "Thyra_StateFuncModelEvaluatorBase.hpp" // Implementation
14 
15 
16 namespace Tempus_Test {
17 
34 template<class Scalar>
36  : public Thyra::StateFuncModelEvaluatorBase<Scalar>
37 {
38  public:
39 
40  // Default Constructor
42 
43  // Constructor
44  DahlquistTestModel(Scalar lambda, bool includeXDot);
45 
46  void constructDahlquistTestModel(Scalar lambda, bool includeXDot);
47 
49  ~DahlquistTestModel() = default;
50 
52  Thyra::ModelEvaluatorBase::InArgs<Scalar> getExactSolution(double t) const;
53 
54  Scalar getLambda() const { return lambda_; }
55 
58  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
59  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_f_space() const;
60  Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
61  Teuchos::RCP<Thyra::LinearOpWithSolveBase<Scalar> > create_W() const;
62  Teuchos::RCP<Thyra::LinearOpBase<Scalar> > create_W_op() const;
63  Teuchos::RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> > get_W_factory() const;
64  Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
65 
66  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_p_space(int l) const;
67  Teuchos::RCP<const Teuchos::Array<std::string> > get_p_names(int l) const;
68  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_g_space(int j) const;
70 
71 private:
72 
75  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
76  void evalModelImpl(
77  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs_bar,
78  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs_bar
79  ) const;
81 
82 private:
83  int dim_;
84  int Np_;
85  int np_;
86  int Ng_;
87  int ng_;
88  bool haveIC_;
90  Scalar lambda_;
92 
93  mutable bool isInitialized_;
94  mutable Thyra::ModelEvaluatorBase::InArgs<Scalar> inArgs_;
95  mutable Thyra::ModelEvaluatorBase::OutArgs<Scalar> outArgs_;
96  mutable Thyra::ModelEvaluatorBase::InArgs<Scalar> nominalValues_;
97  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > x_space_;
98  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > f_space_;
99  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > p_space_;
100  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > g_space_;
101  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > DxDp_space_;
102 
103  Scalar xIC_;
104  Scalar xDotIC_;
105 };
106 
107 
108 } // namespace Tempus_Test
109 #endif // TEMPUS_TEST_DAHLQUIST_TEST_MODEL_DECL_HPP
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > x_space_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > p_space_
The classic Dahlquist Test Problem.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Scalar xIC_
Initial condition for x.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > g_space_
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int j) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > f_space_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int l) const
Scalar xDotIC_
Initial condition for xDot.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > DxDp_space_
~DahlquistTestModel()=default
Default destructor.
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs_bar, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs_bar) const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs_
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > getExactSolution(double t) const
Exact solution.
void constructDahlquistTestModel(Scalar lambda, bool includeXDot)
Teuchos::RCP< Thyra::LinearOpWithSolveBase< Scalar > > create_W() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > nominalValues_
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const