Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_ModelEvaluator.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Panzer: A partial differential equation assembly
5 // engine for strongly coupled complex multiphysics systems
6 // Copyright (2011) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and
39 // Eric C. Cyr (eccyr@sandia.gov)
40 // ***********************************************************************
41 // @HEADER
42 
43 #ifndef PANZER_MODEL_EVALUATOR_DECL_HPP
44 #define PANZER_MODEL_EVALUATOR_DECL_HPP
45 
46 #include "PanzerDiscFE_config.hpp"
47 
48 #include "Panzer_Traits.hpp"
55 
56 #include "Teuchos_RCP.hpp"
57 #include "Teuchos_AbstractFactory.hpp"
58 
59 #include "Thyra_VectorBase.hpp"
60 #include "Thyra_VectorSpaceBase.hpp"
61 #include "Thyra_StateFuncModelEvaluatorBase.hpp"
62 #include "Thyra_LinearOpWithSolveFactoryBase.hpp"
63 
64 #include <Panzer_NodeType.hpp>
65 
66 namespace panzer {
67 
68 class FieldManagerBuilder;
69 template<typename> class LinearObjFactory;
70 struct GlobalData;
71 
72 template<typename Scalar>
74  : public Thyra::StateFuncModelEvaluatorBase<Scalar>
75 {
76 public:
77 
78 public:
79 
82 
86  const std::vector<Teuchos::RCP<Teuchos::Array<std::string> > >& p_names,
87  const std::vector<Teuchos::RCP<Teuchos::Array<double> > >& p_values,
88  const Teuchos::RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> > & solverFactory,
89  const Teuchos::RCP<panzer::GlobalData>& global_data,
90  bool build_transient_support,double t_init);
91 
93  const Teuchos::RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> > & solverFactory,
94  const Teuchos::RCP<panzer::GlobalData>& global_data,
95  bool build_transient_support,double t_init);
96 
99 
101 
104 
107 
110 
113 
116 
119 
121  const std::string & get_g_name(int i) const;
122 
125 
128 
131 
134 
136  Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const override;
137 
138  Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const override;
139 
141 
146  template<typename EvalT>
148  {
149  ae_tm_.template disableType<EvalT>();
150  auto idx = Sacado::mpl::find<panzer::Traits::EvalTypes,EvalT>::value;
151  active_evaluation_types_[idx] = false;
152  }
153 
158  void buildVolumeFieldManagers(const bool value);
159 
164  void buildBCFieldManagers(const bool value);
165 
167  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
168  const std::vector<panzer::BC> & bcs,
169  const panzer::EquationSetFactory & eqset_factory,
170  const panzer::BCStrategyFactory& bc_factory,
173  const Teuchos::ParameterList& closure_models,
174  const Teuchos::ParameterList& user_data,
175  bool writeGraph=false,const std::string & graphPrefix="",
176  const Teuchos::ParameterList& me_params = Teuchos::ParameterList());
177 
189  int addParameter(const std::string & name,const Scalar & initial);
190 
201  int addParameter(const Teuchos::Array<std::string> & names,
202  const Teuchos::Array<Scalar> & initialValues);
203 
220  int addDistributedParameter(const std::string & name,
221  const Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > & vs,
223  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & initial,
224  const Teuchos::RCP<const GlobalIndexer> & ugi=Teuchos::null);
225 
234  void addNonParameterGlobalEvaluationData(const std::string & name,
236 
253  int addFlexibleResponse(const std::string & responseName,
254  const std::vector<WorksetDescriptor> & wkst_desc,
256 
272  template <typename ResponseEvaluatorFactory_BuilderT>
273  int addResponse(const std::string & responseName,
274  const std::vector<WorksetDescriptor> & wkst_desc,
275  const ResponseEvaluatorFactory_BuilderT & builder);
276 
281  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
282  const panzer::EquationSetFactory & eqset_factory,
284  const Teuchos::ParameterList& closure_models,
285  const Teuchos::ParameterList& user_data,
286  const bool write_graphviz_file=false,
287  const std::string& graphviz_file_prefix="")
288  { responseLibrary_->buildResponseEvaluators(physicsBlocks,eqset_factory,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix);
291  this->resetDefaultBase();
292 
293  typedef Thyra::ModelEvaluatorBase MEB;
294  MEB::OutArgsSetup<Scalar> outArgs;
295  outArgs.setModelEvalDescription(this->description());
296  outArgs.set_Np_Ng(num_me_parameters_, responses_.size());
297  outArgs.setSupports(MEB::OUT_ARG_f);
298  outArgs.setSupports(MEB::OUT_ARG_W_op);
299  prototypeOutArgs_ = outArgs; }
300 
305  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
307  const Teuchos::ParameterList& closure_models,
308  const Teuchos::ParameterList& user_data,
309  const bool write_graphviz_file=false,
310  const std::string& graphviz_file_prefix="")
311  { responseLibrary_->buildResponseEvaluators(physicsBlocks,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix);
314  this->resetDefaultBase();
315 
316  typedef Thyra::ModelEvaluatorBase MEB;
317  MEB::OutArgsSetup<Scalar> outArgs;
318  outArgs.setModelEvalDescription(this->description());
319  outArgs.set_Np_Ng(num_me_parameters_, responses_.size());
320  outArgs.setSupports(MEB::OUT_ARG_f);
321  outArgs.setSupports(MEB::OUT_ARG_W_op);
322  prototypeOutArgs_ = outArgs; }
323 
331  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
332  const std::vector<panzer::BC> & bcs,
333  const panzer::EquationSetFactory & eqset_factory,
334  const panzer::BCStrategyFactory& bc_factory,
336  const Teuchos::ParameterList& closure_models,
337  const Teuchos::ParameterList& user_data,
338  const bool write_graphviz_file=false,
339  const std::string& graphviz_file_prefix="");
340 
349  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
350  const std::vector<panzer::BC> & bcs,
351  const panzer::EquationSetFactory & eqset_factory,
352  const panzer::BCStrategyFactory& bc_factory,
354  const Teuchos::ParameterList& closure_models,
355  const Teuchos::ParameterList& user_data,
356  const bool write_graphviz_file=false,
357  const std::string& graphviz_file_prefix="");
358 
366  void setOneTimeDirichletBeta(const Scalar & beta) const;
367 
372  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & f) const;
373 
379  void setupAssemblyInArgs(const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
380  panzer::AssemblyEngineInArgs & ae_inargs) const;
381 
382 
388  return ae_tm_;
389  }
390 
392  { return responseLibrary_; }
393 
396  int getXTangentVectorIndex(const int index) const {
397  int v_index = 0;
398  for (int i=0; i<index; i++) {
399  if (!parameters_[i]->is_distributed)
400  ++v_index;
401  }
402  return v_index + parameters_.size();
403  }
404 
407  int getXDotTangentVectorIndex(const int index) const {
408  int v_index = 0;
409  for (int i=0; i<index; i++) {
410  if (!parameters_[i]->is_distributed)
411  ++v_index;
412  }
413  return v_index + parameters_.size() + tangent_space_.size();
414  }
415 
419  return parameters_[index]->initial_value;
420  }
421 
429  void evalModel_D2gDx2(int rIndex,
430  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
431  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
432  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDx2) const;
433 
442  void evalModel_D2gDp2(int rIndex,
443  int pIndex,
444  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
445  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
446  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDp2) const;
447 
456  void evalModel_D2gDpDx(int rIndex,
457  int pIndex,
458  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
459  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
460  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDpDx) const;
461 
470  void evalModel_D2gDxDp(int rIndex,
471  int pIndex,
472  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
473  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_p,
474  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDxDp) const;
475 
483  void evalModel_D2fDx2(const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
484  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
485  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDx2) const;
486 
495  void evalModel_D2fDp2(int pIndex,
496  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
497  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
498  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDp2) const;
499 
508  void evalModel_D2fDpDx(int pIndex,
509  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
510  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
511  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDpDx) const;
512 
521  void evalModel_D2fDxDp(int pIndex,
522  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
523  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_p,
524  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDxDp) const;
525 
526 protected:
527 
530 
532  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const override;
533 
535  virtual void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
536  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const override;
537 
539 
541  virtual void evalModelImpl_basic(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
542  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
543 
545  virtual void evalModelImpl_basic_g(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
546  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
547 
553  virtual void evalModelImpl_basic_dgdx(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
554  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
555 
561  virtual void evalModelImpl_basic_dgdp_scalar(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
562  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
563 
569  virtual void evalModelImpl_basic_dgdp_distro(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
570  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
571 
577  virtual void evalModelImpl_basic_dfdp_scalar(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
578  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
579 
585  virtual void evalModelImpl_basic_dfdp_scalar_fd(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
586  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
587 
593  virtual void evalModelImpl_basic_dfdp_distro(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
594  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
595 
597  bool required_basic_g(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
598 
600  bool required_basic_dgdx(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
601 
603  bool required_basic_dgdp_scalar(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
604 
606  bool required_basic_dgdp_distro(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
607 
609  bool required_basic_dfdp_scalar(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
610 
612  bool required_basic_dfdp_distro(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
613 
615  void initializeNominalValues() const;
616 
617  // Set parameters in model supplied by inArgs
618  void setParameters(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs) const;
619 
620  // Reset parameters back to nominal values
621  void resetParameters() const;
622 
623 private: // data members
624 
626  bool is_distributed; // or (is scalar?)
630 
631  // for distributed parameters
634  // for residual sensitivities with respect to a distributed parameter
636  // for response sensitivities with respect to a distributed parameter
637 
638  // for scalar parameters
640  };
641 
642  struct ResponseObject {
643  std::string name;
645 
646  // for distributed parameter sensitivities
648  // used for delayed construction of dgdp (distributed parameter) responses
649  std::vector<WorksetDescriptor> wkst_desc;
650  // used for delayed construction of dgdp (distributed parameter) responses
651 
652  struct SearchName {
653  std::string name;
654  SearchName(const std::string & n) : name(n) {}
655  bool operator()(const Teuchos::RCP<ResponseObject> & ro) { return name==ro->name; }
656  };
657  };
658 
660  const Teuchos::Array<Scalar> & in_values) const;
662  const Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > & vs,
663  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & initial,
664  const Teuchos::RCP<const GlobalIndexer> & ugi) const;
665 
666  double t_init_;
667 
670 
671  mutable Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
672  mutable Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
673 
674  mutable Thyra::ModelEvaluatorBase::InArgs<Scalar> nominalValues_;
675 
676  mutable panzer::AssemblyEngine_TemplateManager<panzer::Traits> ae_tm_; // they control and provide access to evaluate
677 
678  std::vector<Teuchos::RCP<ParameterObject> > parameters_;
679  std::vector<Teuchos::RCP<Thyra::VectorSpaceBase<double> > > tangent_space_;
683 
686 
687  // responses
689  std::vector<Teuchos::RCP<ResponseObject> > responses_;
690 
693 
694  // basic specific linear object objects
699 
700 
702 
705 
707  mutable Scalar oneTimeDirichletBeta_;
708 
711  std::vector<bool> active_evaluation_types_;
712 };
713 
714 // Inline definition of the add response (its template on the builder type)
715 template<typename Scalar>
716 template <typename ResponseEvaluatorFactory_BuilderT>
718 addResponse(const std::string & responseName,
719  const std::vector<WorksetDescriptor> & wkst_desc,
720  const ResponseEvaluatorFactory_BuilderT & builder)
721 {
722  using Teuchos::RCP;
723  using Teuchos::rcp;
724 
725  // see if the response evaluators have been constucted yet
726  TEUCHOS_TEST_FOR_EXCEPTION(responseLibrary_->responseEvaluatorsBuilt(),std::logic_error,
727  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
728  "cannot be added to the model evaluator because evalModel has already been called!");
729 
730  // add the response
731  responseLibrary_->addResponse(responseName,wkst_desc,builder);
732 
733  // check that the response can be found
734  TEUCHOS_TEST_FOR_EXCEPTION(std::find_if(responses_.begin(),responses_.end(),typename ResponseObject::SearchName(responseName))!=responses_.end(),
735  std::logic_error,
736  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
737  "has already been added to the model evaluator!");
738 
739  // allocate response object
740  RCP<ResponseObject> respObject = rcp(new ResponseObject);
741 
742  // handle panzer::Traits::Residual
743  {
744  // check that at least there is a response value
745  Teuchos::RCP<panzer::ResponseBase> respBase = responseLibrary_->getResponse<panzer::Traits::Residual>(responseName);
746  TEUCHOS_TEST_FOR_EXCEPTION(respBase==Teuchos::null,std::logic_error,
747  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
748  "has no residual type! Not sure what is going on!");
749 
750  // check that the response supports interactions with the model evaluator
752  Teuchos::rcp_dynamic_cast<panzer::ResponseMESupportBase<panzer::Traits::Residual> >(respBase);
753  TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
754  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
755  "resulted in bad cast to panzer::ResponseMESupportBase, the type of the response is incompatible!");
756 
757  // set the response in the model evaluator
758  Teuchos::RCP<const Thyra::VectorSpaceBase<double> > vs = resp->getVectorSpace();
759  respObject->space = vs;
760 
761  // lets be cautious and set a vector on the response
762  resp->setVector(Thyra::createMember(vs));
763  }
764 
765  // handle panzer::Traits::Jacobian (do a quick safety check, response is null or appropriate for jacobian)
766  Teuchos::RCP<panzer::ResponseBase> respJacBase = responseLibrary_->getResponse<panzer::Traits::Jacobian>(responseName);
767  if(respJacBase!=Teuchos::null) {
768  typedef panzer::Traits::Jacobian RespEvalT;
769 
770  // check that the response supports interactions with the model evaluator
772  Teuchos::rcp_dynamic_cast<panzer::ResponseMESupportBase<RespEvalT> >(respJacBase);
773  TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
774  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName <<
775  "\" resulted in bad cast to panzer::ResponseMESupportBase<Jacobian>, the type "
776  "of the response is incompatible!");
777 
778  // setup the vector (register response as epetra)
779  if(resp->supportsDerivative())
780  resp->setDerivative(resp->buildDerivative());
781  }
782 
783 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
784  // handle panzer::Traits::Hessian (do a quick safety check, response is null or appropriate for jacobian)
785  Teuchos::RCP<panzer::ResponseBase> respHesBase = responseLibrary_->getResponse<panzer::Traits::Hessian>(responseName);
786  if(respHesBase!=Teuchos::null) {
787  typedef panzer::Traits::Hessian RespEvalT;
788 
789  // check that the response supports interactions with the model evaluator
791  Teuchos::rcp_dynamic_cast<panzer::ResponseMESupportBase<RespEvalT> >(respHesBase);
792  TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
793  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName <<
794  "\" resulted in bad cast to panzer::ResponseMESupportBase<Hessian>, the type "
795  "of the response is incompatible!");
796 
797  // setup the vector (register response as epetra)
798  if(resp->supportsDerivative())
799  resp->setDerivative(resp->buildDerivative());
800  }
801 #endif
802 
803  respObject->name = responseName;
804  respObject->wkst_desc = wkst_desc;
805 
806  responses_.push_back(respObject);
807 
808  require_in_args_refresh_ = true;
809  require_out_args_refresh_ = true;
810  this->resetDefaultBase();
811 
812  return responses_.size()-1;
813 }
814 
815 
816 }
817 
818 // #include "Panzer_ModelEvaluator_impl.hpp"
819 
820 #endif
panzer::AssemblyEngine_TemplateManager< panzer::Traits > getAssemblyEngineTemplateManager() const
return a copy of the model evaluators template manager, this is shallow class so pass by value ...
Interface for constructing a BCStrategy_TemplateManager.
std::vector< WorksetDescriptor > wkst_desc
Allocates and initializes an equation set template manager.
virtual void evalModelImpl_basic_dgdp_distro(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Teuchos::RCP< const Thyra::VectorBase< Scalar > > get_parameter_vector(int index) const
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int i) const override
Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > dfdp_rl
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const override
Teuchos::RCP< const GlobalIndexer > global_indexer
std::vector< Teuchos::RCP< ParameterObject > > parameters_
void evalModel_D2gDp2(int rIndex, int pIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &D2gDp2) const
void initializeNominalValues() const
Initialize the nominal values with good starting conditions.
int addDistributedParameter(const std::string &name, const Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > &vs, const Teuchos::RCP< GlobalEvaluationData > &ged, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &initial, const Teuchos::RCP< const GlobalIndexer > &ugi=Teuchos::null)
GlobalEvaluationDataContainer nonParamGlobalEvaluationData_
int addFlexibleResponse(const std::string &responseName, const std::vector< WorksetDescriptor > &wkst_desc, const Teuchos::RCP< ResponseMESupportBuilderBase > &builder)
Teuchos::RCP< const Thyra::VectorBase< Scalar > > initial_value
void evalModel_D2gDx2(int rIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &D2gDx2) const
void evalModel_D2fDp2(int pIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_x, const Teuchos::RCP< Thyra::LinearOpBase< Scalar > > &D2fDp2) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const override
Thyra::ModelEvaluatorBase::InArgs< Scalar > prototypeInArgs_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > space
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< ParameterObject > createScalarParameter(const Teuchos::Array< std::string > &names, const Teuchos::Array< Scalar > &in_values) const
panzer::AssemblyEngine_TemplateManager< panzer::Traits > ae_tm_
void buildDistroParamDgDp_RL(const Teuchos::RCP< panzer::WorksetContainer > &wc, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const std::vector< panzer::BC > &bcs, const panzer::EquationSetFactory &eqset_factory, const panzer::BCStrategyFactory &bc_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, const bool write_graphviz_file=false, const std::string &graphviz_file_prefix="")
std::vector< Teuchos::RCP< ResponseObject > > responses_
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_DfDp_op(int i) const override
void evalModel_D2fDxDp(int pIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_p, const Teuchos::RCP< Thyra::LinearOpBase< Scalar > > &D2fDxDp) const
void setupAssemblyInArgs(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, panzer::AssemblyEngineInArgs &ae_inargs) const
void buildVolumeFieldManagers(const bool value)
Teuchos::RCP< Teuchos::Array< std::string > > names
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const override
Teuchos::RCP< panzer::GlobalData > global_data_
void evalModel_D2gDpDx(int rIndex, int pIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &D2gDpDx) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int i) const override
void setOneTimeDirichletBeta(const Scalar &beta) const
virtual void evalModelImpl_basic(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Evaluate a simple model, meaning a residual and a jacobian, no fancy stochastic galerkin or multipoin...
std::vector< bool > active_evaluation_types_
void evalModel_D2fDx2(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_x, const Teuchos::RCP< Thyra::LinearOpBase< Scalar > > &D2fDx2) const
bool required_basic_g(const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Does this set of out args require a simple response?
Sacado::ScalarParameterVector< panzer::EvaluationTraits > ParamVec
virtual void evalModelImpl_basic_dgdx(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
bool required_basic_dgdp_distro(const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Are their required responses in the out args? DgDp.
Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > dgdp_rl
const std::string & get_g_name(int i) const
bool operator()(const Teuchos::RCP< ResponseObject > &ro)
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const override
int addResponse(const std::string &responseName, const std::vector< WorksetDescriptor > &wkst_desc, const ResponseEvaluatorFactory_BuilderT &builder)
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > x_space_
void setParameters(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs) const
int getXTangentVectorIndex(const int index) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > f_space_
Teuchos::ArrayView< const std::string > get_g_names(int i) const override
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const override
Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > getResponseLibrary() const
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const override
virtual void evalModelImpl_basic_g(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Construct a simple response dicatated by this set of out args.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< ParameterObject > createDistributedParameter(const std::string &key, const Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > &vs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &initial, const Teuchos::RCP< const GlobalIndexer > &ugi) const
GlobalEvaluationDataContainer distrParamGlobalEvaluationData_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > space
Teuchos::RCP< const panzer::LinearObjFactory< panzer::Traits > > lof_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int i) const override
void buildResponses(const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, const bool write_graphviz_file=false, const std::string &graphviz_file_prefix="")
bool required_basic_dgdp_scalar(const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Are their required responses in the out args? DgDp.
Thyra::ModelEvaluatorBase::OutArgs< Scalar > prototypeOutArgs_
std::vector< Teuchos::RCP< Thyra::VectorSpaceBase< double > > > tangent_space_
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > solverFactory_
bool required_basic_dgdx(const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Are their required responses in the out args? DgDx.
virtual void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const override
virtual void evalModelImpl_basic_dfdp_distro(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
virtual void evalModelImpl_basic_dfdp_scalar(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
void buildDistroParamDfDp_RL(const Teuchos::RCP< panzer::WorksetContainer > &wc, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const std::vector< panzer::BC > &bcs, const panzer::EquationSetFactory &eqset_factory, const panzer::BCStrategyFactory &bc_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, const bool write_graphviz_file=false, const std::string &graphviz_file_prefix="")
void setupModel(const Teuchos::RCP< panzer::WorksetContainer > &wc, const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const std::vector< panzer::BC > &bcs, const panzer::EquationSetFactory &eqset_factory, const panzer::BCStrategyFactory &bc_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &volume_cm_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &bc_cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, bool writeGraph=false, const std::string &graphPrefix="", const Teuchos::ParameterList &me_params=Teuchos::ParameterList())
virtual void evalModelImpl_basic_dfdp_scalar_fd(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const override
Teuchos::RCP< ResponseMESupportBuilderBase > builder
Teuchos::RCP< panzer::LinearObjContainer > ghostedContainer_
void buildResponses(const std::vector< Teuchos::RCP< panzer::PhysicsBlock > > &physicsBlocks, const panzer::EquationSetFactory &eqset_factory, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &cm_factory, const Teuchos::ParameterList &closure_models, const Teuchos::ParameterList &user_data, const bool write_graphviz_file=false, const std::string &graphviz_file_prefix="")
Teuchos::RCP< panzer::ResponseLibrary< panzer::Traits > > responseLibrary_
void addNonParameterGlobalEvaluationData(const std::string &name, const Teuchos::RCP< GlobalEvaluationData > &ged)
bool required_basic_dfdp_scalar(const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Are derivatives of the residual with respect to the scalar parameters in the out args? DfDp.
Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > xdotContainer_
void evalModel_D2fDpDx(int pIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_x, const Teuchos::RCP< Thyra::LinearOpBase< Scalar > > &D2fDpDx) const
void evalModel_D2gDxDp(int rIndex, int pIndex, const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Teuchos::RCP< const Thyra::VectorBase< Scalar > > &delta_p, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &D2gDxDp) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > nominalValues_
void applyDirichletBCs(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &f) const
bool required_basic_dfdp_distro(const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Are derivatives of the residual with respect to the distributed parameters in the out args...
int getXDotTangentVectorIndex(const int index) const
virtual void evalModelImpl_basic_dgdp_scalar(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Teuchos::RCP< ReadOnlyVector_GlobalEvaluationData > xContainer_
void buildBCFieldManagers(const bool value)
int addParameter(const std::string &name, const Scalar &initial)