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 
143  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
144  const std::vector<panzer::BC> & bcs,
145  const panzer::EquationSetFactory & eqset_factory,
146  const panzer::BCStrategyFactory& bc_factory,
149  const Teuchos::ParameterList& closure_models,
150  const Teuchos::ParameterList& user_data,
151  bool writeGraph=false,const std::string & graphPrefix="",
152  const Teuchos::ParameterList& me_params = Teuchos::ParameterList());
153 
165  int addParameter(const std::string & name,const Scalar & initial);
166 
177  int addParameter(const Teuchos::Array<std::string> & names,
178  const Teuchos::Array<Scalar> & initialValues);
179 
196  int addDistributedParameter(const std::string & name,
197  const Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > & vs,
199  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & initial,
200  const Teuchos::RCP<const UniqueGlobalIndexerBase> & ugi=Teuchos::null);
201 
210  void addNonParameterGlobalEvaluationData(const std::string & name,
212 
229  int addFlexibleResponse(const std::string & responseName,
230  const std::vector<WorksetDescriptor> & wkst_desc,
232 
248  template <typename ResponseEvaluatorFactory_BuilderT>
249  int addResponse(const std::string & responseName,
250  const std::vector<WorksetDescriptor> & wkst_desc,
251  const ResponseEvaluatorFactory_BuilderT & builder);
252 
257  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
258  const panzer::EquationSetFactory & eqset_factory,
260  const Teuchos::ParameterList& closure_models,
261  const Teuchos::ParameterList& user_data,
262  const bool write_graphviz_file=false,
263  const std::string& graphviz_file_prefix="")
264  { responseLibrary_->buildResponseEvaluators(physicsBlocks,eqset_factory,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix);
267  this->resetDefaultBase();
268 
269  typedef Thyra::ModelEvaluatorBase MEB;
270  MEB::OutArgsSetup<Scalar> outArgs;
271  outArgs.setModelEvalDescription(this->description());
272  outArgs.set_Np_Ng(num_me_parameters_, responses_.size());
273  outArgs.setSupports(MEB::OUT_ARG_f);
274  outArgs.setSupports(MEB::OUT_ARG_W_op);
275  prototypeOutArgs_ = outArgs; }
276 
281  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
283  const Teuchos::ParameterList& closure_models,
284  const Teuchos::ParameterList& user_data,
285  const bool write_graphviz_file=false,
286  const std::string& graphviz_file_prefix="")
287  { responseLibrary_->buildResponseEvaluators(physicsBlocks,cm_factory,closure_models,user_data,write_graphviz_file,graphviz_file_prefix);
290  this->resetDefaultBase();
291 
292  typedef Thyra::ModelEvaluatorBase MEB;
293  MEB::OutArgsSetup<Scalar> outArgs;
294  outArgs.setModelEvalDescription(this->description());
295  outArgs.set_Np_Ng(num_me_parameters_, responses_.size());
296  outArgs.setSupports(MEB::OUT_ARG_f);
297  outArgs.setSupports(MEB::OUT_ARG_W_op);
298  prototypeOutArgs_ = outArgs; }
299 
307  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
308  const std::vector<panzer::BC> & bcs,
309  const panzer::EquationSetFactory & eqset_factory,
310  const panzer::BCStrategyFactory& bc_factory,
312  const Teuchos::ParameterList& closure_models,
313  const Teuchos::ParameterList& user_data,
314  const bool write_graphviz_file=false,
315  const std::string& graphviz_file_prefix="");
316 
325  const std::vector<Teuchos::RCP<panzer::PhysicsBlock> >& physicsBlocks,
326  const std::vector<panzer::BC> & bcs,
327  const panzer::EquationSetFactory & eqset_factory,
328  const panzer::BCStrategyFactory& bc_factory,
330  const Teuchos::ParameterList& closure_models,
331  const Teuchos::ParameterList& user_data,
332  const bool write_graphviz_file=false,
333  const std::string& graphviz_file_prefix="");
334 
342  void setOneTimeDirichletBeta(const Scalar & beta) const;
343 
348  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & f) const;
349 
355  void setupAssemblyInArgs(const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
356  panzer::AssemblyEngineInArgs & ae_inargs) const;
357 
358 
364  return ae_tm_;
365  }
366 
368  { return responseLibrary_; }
369 
372  int getXTangentVectorIndex(const int index) const {
373  int v_index = 0;
374  for (int i=0; i<index; i++) {
375  if (!parameters_[i]->is_distributed)
376  ++v_index;
377  }
378  return v_index + parameters_.size();
379  }
380 
383  int getXDotTangentVectorIndex(const int index) const {
384  int v_index = 0;
385  for (int i=0; i<index; i++) {
386  if (!parameters_[i]->is_distributed)
387  ++v_index;
388  }
389  return v_index + parameters_.size() + tangent_space_.size();
390  }
391 
395  return parameters_[index]->initial_value;
396  }
397 
405  void evalModel_D2gDx2(int rIndex,
406  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
407  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
408  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDx2) const;
409 
418  void evalModel_D2gDp2(int rIndex,
419  int pIndex,
420  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
421  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
422  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDp2) const;
423 
432  void evalModel_D2gDpDx(int rIndex,
433  int pIndex,
434  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
435  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
436  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDpDx) const;
437 
446  void evalModel_D2gDxDp(int rIndex,
447  int pIndex,
448  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
449  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_p,
450  const Teuchos::RCP<Thyra::VectorBase<Scalar> > & D2gDxDp) const;
451 
459  void evalModel_D2fDx2(const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
460  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
461  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDx2) const;
462 
471  void evalModel_D2fDp2(int pIndex,
472  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
473  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
474  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDp2) const;
475 
484  void evalModel_D2fDpDx(int pIndex,
485  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
486  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_x,
487  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDpDx) const;
488 
497  void evalModel_D2fDxDp(int pIndex,
498  const Thyra::ModelEvaluatorBase::InArgs<Scalar> & inArgs,
499  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & delta_p,
500  const Teuchos::RCP<Thyra::LinearOpBase<Scalar> > & D2fDxDp) const;
501 
502 protected:
503 
506 
508  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const override;
509 
511  virtual void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
512  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const override;
513 
515 
517  virtual void evalModelImpl_basic(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
518  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
519 
521  virtual void evalModelImpl_basic_g(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
522  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
523 
529  virtual void evalModelImpl_basic_dgdx(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
530  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
531 
537  virtual void evalModelImpl_basic_dgdp_scalar(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
538  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
539 
545  virtual void evalModelImpl_basic_dgdp_distro(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
546  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
547 
553  virtual void evalModelImpl_basic_dfdp_scalar(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
554  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
555 
561  virtual void evalModelImpl_basic_dfdp_scalar_fd(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
562  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
563 
569  virtual void evalModelImpl_basic_dfdp_distro(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
570  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
571 
573  bool required_basic_g(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
574 
576  bool required_basic_dgdx(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
577 
579  bool required_basic_dgdp_scalar(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
580 
582  bool required_basic_dgdp_distro(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
583 
585  bool required_basic_dfdp_scalar(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
586 
588  bool required_basic_dfdp_distro(const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
589 
591  void initializeNominalValues() const;
592 
593  // Set parameters in model supplied by inArgs
594  void setParameters(const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs) const;
595 
596  // Reset parameters back to nominal values
597  void resetParameters() const;
598 
599 private: // data members
600 
602  bool is_distributed; // or (is scalar?)
606 
607  // for distributed parameters
610  // for residual sensitivities with respect to a distributed parameter
612  // for response sensitivities with respect to a distributed parameter
613 
614  // for scalar parameters
616  };
617 
618  struct ResponseObject {
619  std::string name;
621 
622  // for distributed parameter sensitivities
624  // used for delayed construction of dgdp (distributed parameter) responses
625  std::vector<WorksetDescriptor> wkst_desc;
626  // used for delayed construction of dgdp (distributed parameter) responses
627 
628  struct SearchName {
629  std::string name;
630  SearchName(const std::string & n) : name(n) {}
631  bool operator()(const Teuchos::RCP<ResponseObject> & ro) { return name==ro->name; }
632  };
633  };
634 
636  const Teuchos::Array<Scalar> & in_values) const;
638  const Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > & vs,
639  const Teuchos::RCP<const Thyra::VectorBase<Scalar> > & initial,
641 
642  double t_init_;
643 
646 
647  mutable Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
648  mutable Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
649 
650  mutable Thyra::ModelEvaluatorBase::InArgs<Scalar> nominalValues_;
651 
652  mutable panzer::AssemblyEngine_TemplateManager<panzer::Traits> ae_tm_; // they control and provide access to evaluate
653 
654  std::vector<Teuchos::RCP<ParameterObject> > parameters_;
655  std::vector<Teuchos::RCP<Thyra::VectorSpaceBase<double> > > tangent_space_;
659 
662 
663  // responses
665  std::vector<Teuchos::RCP<ResponseObject> > responses_;
666 
669 
670  // basic specific linear object objects
675 
676 
678 
681 
683  mutable Scalar oneTimeDirichletBeta_;
684 };
685 
686 // Inline definition of the add response (its template on the builder type)
687 template<typename Scalar>
688 template <typename ResponseEvaluatorFactory_BuilderT>
690 addResponse(const std::string & responseName,
691  const std::vector<WorksetDescriptor> & wkst_desc,
692  const ResponseEvaluatorFactory_BuilderT & builder)
693 {
694  using Teuchos::RCP;
695  using Teuchos::rcp;
696 
697  // see if the response evaluators have been constucted yet
698  TEUCHOS_TEST_FOR_EXCEPTION(responseLibrary_->responseEvaluatorsBuilt(),std::logic_error,
699  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
700  "cannot be added to the model evaluator because evalModel has already been called!");
701 
702  // add the response
703  responseLibrary_->addResponse(responseName,wkst_desc,builder);
704 
705  // check that the response can be found
706  TEUCHOS_TEST_FOR_EXCEPTION(std::find_if(responses_.begin(),responses_.end(),typename ResponseObject::SearchName(responseName))!=responses_.end(),
707  std::logic_error,
708  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
709  "has already been added to the model evaluator!");
710 
711  // allocate response object
712  RCP<ResponseObject> respObject = rcp(new ResponseObject);
713 
714  // handle panzer::Traits::Residual
715  {
716  // check that at least there is a response value
717  Teuchos::RCP<panzer::ResponseBase> respBase = responseLibrary_->getResponse<panzer::Traits::Residual>(responseName);
718  TEUCHOS_TEST_FOR_EXCEPTION(respBase==Teuchos::null,std::logic_error,
719  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
720  "has no residual type! Not sure what is going on!");
721 
722  // check that the response supports interactions with the model evaluator
724  Teuchos::rcp_dynamic_cast<panzer::ResponseMESupportBase<panzer::Traits::Residual> >(respBase);
725  TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
726  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName << "\" "
727  "resulted in bad cast to panzer::ResponseMESupportBase, the type of the response is incompatible!");
728 
729  // set the response in the model evaluator
730  Teuchos::RCP<const Thyra::VectorSpaceBase<double> > vs = resp->getVectorSpace();
731  respObject->space = vs;
732 
733  // lets be cautious and set a vector on the response
734  resp->setVector(Thyra::createMember(vs));
735  }
736 
737  // handle panzer::Traits::Jacobian (do a quick safety check, response is null or appropriate for jacobian)
738  Teuchos::RCP<panzer::ResponseBase> respJacBase = responseLibrary_->getResponse<panzer::Traits::Jacobian>(responseName);
739  if(respJacBase!=Teuchos::null) {
740  typedef panzer::Traits::Jacobian RespEvalT;
741 
742  // check that the response supports interactions with the model evaluator
744  Teuchos::rcp_dynamic_cast<panzer::ResponseMESupportBase<RespEvalT> >(respJacBase);
745  TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
746  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName <<
747  "\" resulted in bad cast to panzer::ResponseMESupportBase<Jacobian>, the type "
748  "of the response is incompatible!");
749 
750  // setup the vector (register response as epetra)
751  if(resp->supportsDerivative())
752  resp->setDerivative(resp->buildDerivative());
753  }
754 
755 #ifdef Panzer_BUILD_HESSIAN_SUPPORT
756  // handle panzer::Traits::Hessian (do a quick safety check, response is null or appropriate for jacobian)
757  Teuchos::RCP<panzer::ResponseBase> respHesBase = responseLibrary_->getResponse<panzer::Traits::Hessian>(responseName);
758  if(respHesBase!=Teuchos::null) {
759  typedef panzer::Traits::Hessian RespEvalT;
760 
761  // check that the response supports interactions with the model evaluator
763  Teuchos::rcp_dynamic_cast<panzer::ResponseMESupportBase<RespEvalT> >(respHesBase);
764  TEUCHOS_TEST_FOR_EXCEPTION(resp==Teuchos::null,std::logic_error,
765  "panzer::ModelEvaluator::addResponse: Response with name \"" << responseName <<
766  "\" resulted in bad cast to panzer::ResponseMESupportBase<Hessian>, the type "
767  "of the response is incompatible!");
768 
769  // setup the vector (register response as epetra)
770  if(resp->supportsDerivative())
771  resp->setDerivative(resp->buildDerivative());
772  }
773 #endif
774 
775  respObject->name = responseName;
776  respObject->wkst_desc = wkst_desc;
777 
778  responses_.push_back(respObject);
779 
780  require_in_args_refresh_ = true;
781  require_out_args_refresh_ = true;
782  this->resetDefaultBase();
783 
784  return responses_.size()-1;
785 }
786 
787 
788 }
789 
790 // #include "Panzer_ModelEvaluator_impl.hpp"
791 
792 #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
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.
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 UniqueGlobalIndexerBase > &ugi) const
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
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...
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 UniqueGlobalIndexerBase > global_indexer
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)
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
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 UniqueGlobalIndexerBase > &ugi=Teuchos::null)
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_
int addParameter(const std::string &name, const Scalar &initial)