Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_WrapStaggeredFSAModelEvaluator.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_WrapStaggeredFSAModelEvaluator_hpp
10 #define Tempus_WrapStaggeredFSAModelEvaluator_hpp
11 
13 #include "Tempus_StaggeredForwardSensitivityModelEvaluator.hpp"
14 #include "Tempus_WrapperModelEvaluatorPairIMEX_Basic.hpp"
16 #include "Tempus_WrapperModelEvaluatorPairPartIMEX_StaggeredFSA.hpp"
17 
18 namespace Tempus {
19 
20 /*! Helper function for creating a StaggeredForwardSensitivityModelEvaluator
21  * from a given application model evaluator. It handles the complexity
22  * introducted by IMEX steppers where the sensitivity model evaluator needs
23  * to be put inside the IMEX pair model evaluators.
24  */
25 template <typename Scalar>
26 Teuchos::RCP< SensitivityModelEvaluatorBase<Scalar> >
28  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model,
29  const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null)
30 {
31  using Teuchos::RCP;
32  using Teuchos::rcp_dynamic_cast;
33 
34  RCP<SensitivityModelEvaluatorBase<Scalar> > wrapped_model;
35 
36  // Test if model is an IMEX pair
37  RCP<const WrapperModelEvaluatorPairIMEX_Basic<Scalar> > modelPairIMEX =
38  rcp_dynamic_cast<const WrapperModelEvaluatorPairIMEX_Basic<Scalar> >(model);
39  RCP<const WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> > modelPairPartIMEX =
40  rcp_dynamic_cast<const WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> >(model);
41  if (modelPairIMEX != Teuchos::null) {
42  wrapped_model =
44  modelPairIMEX, pList));
45  }
46  else if (modelPairPartIMEX != Teuchos::null) {
47  wrapped_model =
49  modelPairPartIMEX, pList));
50  }
51  else {
52  wrapped_model =
54  model, pList));
55  }
56 
57  return wrapped_model;
58 }
59 
60 template <typename Scalar>
61 Teuchos::RCP< SensitivityModelEvaluatorBase<Scalar> >
63  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> > & model,
64  const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null)
65 {
66  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > cmodel = model;
67  return wrapStaggeredFSAModelEvaluator(cmodel, pList);
68 }
69 
70 } // namespace Tempus
71 
72 #endif
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
Specialization of IMEX ME for &quot;staggered&quot; FSA method.
Teuchos::RCP< SensitivityModelEvaluatorBase< Scalar > > wrapStaggeredFSAModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< const Teuchos::ParameterList > &pList=Teuchos::null)
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
Transform a ModelEvaluator&#39;s sensitivity equations to its residual.
Specialization of IMEX-Part ME for &quot;combined&quot; FSA method.