Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_AuxiliaryIntegralModelEvaluator_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_AuxiliaryIntegralModelEvaluator_decl_hpp
10 #define Tempus_AuxiliaryIntegralModelEvaluator_decl_hpp
11 
12 #include "Thyra_StateFuncModelEvaluatorBase.hpp"
13 
14 #include "Tempus_SolutionHistory.hpp"
15 
16 namespace Tempus {
17 
18 /** \brief ModelEvaluator for integrating auxiliary equations. */
19 /**
20  * Given a ModelEvaluator defining an auxiliary/response function g(x_dot,x,p,t)
21  * this ModelEvaluator defines a new ODE
22  * dz/dt = g(x_dot(t),x(t),p,t)
23  * used to compute the integral of g over some time range. This ModelEvaluator
24  * can then be used by Tempus to compute the definite integral.
25  */
26 template <typename Scalar>
28  public Thyra::StateFuncModelEvaluatorBase<Scalar> {
29 public:
30  typedef Thyra::VectorBase<Scalar> Vector;
31  typedef Thyra::MultiVectorBase<Scalar> MultiVector;
32 
33  //! Constructor
35  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model,
36  const int g_index);
37 
38  //! Get the underlying model 'f'
39  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const
40  { return model_; }
41 
42  //! Set solution history from forward evaluation
44  const Teuchos::RCP<const Tempus::SolutionHistory<Scalar> >& sh);
45 
46  /** \name Public functions overridden from ModelEvaulator. */
47  //@{
48 
49  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_p_space(int p) const;
50 
51  Teuchos::RCP<const Teuchos::Array<std::string> > get_p_names(int p) const;
52 
53  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
54 
55  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_f_space() const;
56 
57  Teuchos::RCP<Thyra::LinearOpBase<Scalar> > create_W_op() const;
58 
59  Teuchos::RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> >
60  get_W_factory() const;
61 
62  Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
63 
64  Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
65 
66  //@}
67 
68 private:
69 
70  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
71 
72  void evalModelImpl(
73  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
74  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
75 
76 
77  Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
78  Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
79 
80  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model_;
81  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > space_;
82  Teuchos::RCP<const Tempus::SolutionHistory<Scalar> > sh_;
83  int g_index_;
84 
85  mutable Teuchos::RCP<Tempus::SolutionState<Scalar> > forward_state_;
86  mutable Scalar t_interp_;
87 };
88 
89 } // namespace Tempus
90 
91 #endif
AuxiliaryIntegralModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const int g_index)
Constructor.
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > prototypeInArgs_
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
ModelEvaluator for integrating auxiliary equations.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
void setForwardSolutionHistory(const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &sh)
Set solution history from forward evaluation.
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
Get the underlying model &#39;f&#39;.
Teuchos::RCP< Tempus::SolutionState< Scalar > > forward_state_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > space_
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int p) const
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Thyra::ModelEvaluatorBase::OutArgs< Scalar > prototypeOutArgs_
Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > sh_
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int p) const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > model_
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const