Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_WrapperModelEvaluatorPairPartIMEX_Basic_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_ModelEvaluatorPairPartIMEX_Basic_decl_hpp
10 #define Tempus_ModelEvaluatorPairPartIMEX_Basic_decl_hpp
11 
12 #include "Tempus_config.hpp"
14 #include "Thyra_StateFuncModelEvaluatorBase.hpp"
15 
16 
17 namespace Tempus {
18 
37 template <typename Scalar>
40 {
41 public:
42 
45 
48  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& explicitModel,
49  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& implicitModel,
50  int numExplicitOnlyBlocks = 0, int parameterIndex = -1);
51 
54 
56  virtual void initialize();
57 
59 
60  virtual void setAppModel(
61  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & me);
63  getAppModel() const;
64 
67  { wrapperImplicitInArgs_.setArgs(inArgs); }
68 
71  { return wrapperImplicitInArgs_; }
72 
75  { wrapperImplicitOutArgs_.setArgs(outArgs); }
76 
79  { return wrapperImplicitOutArgs_; }
80 
85  EVALUATION_TYPE /* evaluationType */ = SOLVE_FOR_X)
86  {
87  timeDer_ = timeDer;
88  wrapperImplicitInArgs_.setArgs(inArgs);
89  wrapperImplicitOutArgs_.setArgs(outArgs);
90  useImplicitModel_ = true;
91  }
92 
94 
96 
99  get_x_space() const;
100 
103  get_g_space(int i) const;
104 
107  get_p_space(int i) const;
109 
111  virtual void setNumExplicitOnlyBlocks(int numExp)
112  {numExplicitOnlyBlocks_ = numExp; }
113  virtual void setExplicitModel(
114  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model )
115  { explicitModel_ = model; }
116  virtual void setImplicitModel(
117  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model );
119  getExplicitModel() const { return explicitModel_; }
121  getImplicitModel() const { return implicitModel_; }
122  virtual int getNumExplicitOnlyBlocks() const
123  { return numExplicitOnlyBlocks_; }
124 
127  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & full) const;
128 
131  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & full) const;
132 
135  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & full) const;
136 
139  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & full) const;
140 
142  virtual void setParameterIndex(int parameterIndex = -1);
144  virtual int getParameterIndex() const { return parameterIndex_; }
145 
147  virtual void setUseImplicitModel(bool tf) { useImplicitModel_ = tf; }
149  virtual bool getUseImplicitModel() const { return useImplicitModel_; }
151 
153 
155  { return implicitModel_->create_W_op(); }
156 
158  get_W_factory() const { return implicitModel_->get_W_factory(); }
159 
161  get_f_space() const;
162 
166 
167  virtual void evalModelImpl(
171 
172 protected:
173 
175  void setup(
176  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& explicitModel,
177  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& implicitModel,
178  int numExplicitOnlyBlocks = 0, int parameterIndex = -1);
179 
182 
186 
190 };
191 
192 } // namespace Tempus
193 
194 #endif // Tempus_ModelEvaluatorPairPartIMEX_Basic_decl_hpp
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getAppModel() const
Get the underlying application ModelEvaluator.
EVALUATION_TYPE
EVALUATION_TYPE indicates the evaluation to apply to the implicit ODE.
virtual void setInArgs(Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs)
Set InArgs the wrapper ModelEvalutor.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int i) const
Get the g space.
virtual void setExplicitModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
virtual int getParameterIndex() const
Get the parameter index for explicit-only vector.
ModelEvaluator pair for implicit and explicit (IMEX) evaluations.
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > getInArgs()
Get InArgs the wrapper ModelEvalutor.
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getExplicitOnlyVector(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &full) const
Extract explicit-only vector from a full solution vector.
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
virtual void setParameterIndex(int parameterIndex=-1)
Set the parameter index for explicit-only vector.
virtual Thyra::ModelEvaluatorBase::OutArgs< Scalar > getOutArgs()
Get OutArgs the wrapper ModelEvalutor.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Get the x-solution space.
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getImplicitModel() const
virtual void setUseImplicitModel(bool tf)
Set parameter to switch wrapperME base functions between explicit and implicit functions.
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
void setup(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &explicitModel, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &implicitModel, int numExplicitOnlyBlocks=0, int parameterIndex=-1)
Setup ME when using default constructor – for derived classes.
virtual void setOutArgs(Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs)
Set OutArgs the wrapper ModelEvalutor.
virtual Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
virtual void setImplicitModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
virtual void setAppModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &me)
Set the underlying application ModelEvaluator.
virtual Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getIMEXVector(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &full) const
Extract IMEX vector from a full solution vector.
This interface defines the time derivative connection between an implicit Stepper and WrapperModelEva...
WrapperModelEvaluatorPairPartIMEX_Basic()
Default constructor – Still requires setting the models and running initialize.
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getExplicitModel() const
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
virtual void setForSolve(Teuchos::RCP< TimeDerivative< Scalar > > timeDer, Thyra::ModelEvaluatorBase::InArgs< Scalar > inArgs, Thyra::ModelEvaluatorBase::OutArgs< Scalar > outArgs, EVALUATION_TYPE=SOLVE_FOR_X)
Set parameters for application implicit ModelEvaluator solve.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int i) const
Get the p space.
virtual bool getUseImplicitModel() const
Get parameter to switch wrapperME base functions between explicit and implicit functions.
Solve for x and determine xDot from x.
virtual void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &in, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &out) const