Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_EquationSet_DefaultImpl_decl.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_EQUATION_SET_DEFAULTIMPL_DECL_HPP
44 #define PANZER_EQUATION_SET_DEFAULTIMPL_DECL_HPP
45 
46 #include "Panzer_EquationSet.hpp"
48 #include "Panzer_CellData.hpp"
49 
50 #include <map>
51 
52 namespace Teuchos {
53  class ParameterList;
54 }
55 
56 namespace PHX {
57  template<typename Traits> class FieldManager;
58 }
59 
60 namespace panzer {
61 
62  template <typename EvalT>
65 
66  public:
67 
69  const int& default_integration_order,
70  const panzer::CellData& cell_data,
71  const Teuchos::RCP<panzer::GlobalData>& global_data,
72  const bool build_transient_support);
73 
75 
77  const panzer::FieldLibrary& fl,
79  const Teuchos::ParameterList& user_data) const;
80 
82  const panzer::FieldLibrary& fl,
84  const Teuchos::ParameterList& user_data) const;
85 
87  const panzer::FieldLibrary& fl,
88  const Teuchos::ParameterList& user_data) const = 0;
89 
94  const Teuchos::ParameterList& user_data) const;
95 
100  const Teuchos::ParameterList& models,
101  const Teuchos::ParameterList& user_data) const;
102 
104  const panzer::FieldLayoutLibrary& fl,
107  const std::string & model_name,
108  const Teuchos::ParameterList& models,
109  const Teuchos::ParameterList& user_data) const;
110 
112  const panzer::FieldLibrary& fl,
114  const std::string& model_name,
115  const Teuchos::ParameterList& models,
117  const Teuchos::ParameterList& user_data) const;
118 
120 
121  virtual const std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > > & getProvidedDOFs() const;
122 
123  virtual const std::vector<std::vector<std::string> > & getCoordinateDOFs() const;
124 
125  virtual const std::map<int,Teuchos::RCP<panzer::IntegrationRule> > & getIntegrationRules() const;
126 
127  virtual void setElementBlockId(const std::string & blockId);
128 
129  virtual std::string getElementBlockId() const;
130 
131  virtual std::string getType() const;
132 
134  virtual void setTangentParamNames(const std::vector<std::string>& tangent_param_names);
135 
144  void getAddedDOFs(std::vector<std::string> & dofNames) const;
145 
160  void updateDOF(const std::string & dofName,
161  int basisOrder,
162  int integrationOrder = -1);
163 
169  int getBasisOrder(const std::string & dofName) const;
170 
176  int getIntegrationOrder(const std::string & dofName) const;
177 
178  protected:
179 
181  virtual void setupDOFs();
182 
184  bool buildTransientSupport() const;
185 
186  // The set of functions below are for use by derived classes to specify the
187  // provided degree of freedom (and associated residual name), in addition
188  // to enabling the, gradient, curl and time derivative for those.
189 
211  void addDOF(const std::string & dofName,
212  const std::string & basisType,
213  const int & basisOrder,
214  const int integrationOrder = -1,
215  const std::string residualName = "",
216  const std::string scatterName = "");
217 
226  void addDOFGrad(const std::string & dofName,
227  const std::string & gradName = "");
228 
237  void addDOFCurl(const std::string & dofName,
238  const std::string & curlName = "");
239 
248  void addDOFDiv(const std::string & dofName,
249  const std::string & divName = "");
250 
259  void addDOFTimeDerivative(const std::string & dofName,
260  const std::string & dotName = "");
261 
269  void setCoordinateDOFs(const std::vector<std::string> & dofNames);
270 
276  void addClosureModel(const std::string& closure_model);
277 
284  void setDefaultValidParameters(Teuchos::ParameterList& valid_parameters);
285 
287  Teuchos::RCP<panzer::PureBasis> getBasisForDOF(const std::string& dof_name) const;
288 
290  Teuchos::RCP<panzer::IntegrationRule> getIntRuleForDOF(const std::string& dof_name) const;
291 
293  Teuchos::RCP<panzer::BasisIRLayout> getBasisIRLayoutForDOF(const std::string& dof_name) const;
294 
309  const std::string dof_name,
310  const std::vector<std::string>& residual_contributions,
311  const std::string residual_field_name = "") const;
312 
329  const std::string dof_name,
330  const std::vector<std::string>& residual_contributions,
331  const std::vector<double>& scale_contributions,
332  const std::string residual_field_name = "") const;
333 
335  //object. Useful for passing off input parameter sublists
336  //directly to evaluators.
338 
339  // Deprecated code support, NOTE: this assumes the same basis and inte rule are used for all dofs in the physics block!!! We are setting these to avoid having to change closure model factories for all physics right away.
341 
342  protected:
343 
344  struct DOFDescriptor {
346  : dofName("")
347  , residualName(std::make_pair(false,""))
348  , grad(std::make_pair(false,""))
349  , curl(std::make_pair(false,""))
350  , div(std::make_pair(false,""))
351  , timeDerivative(std::make_pair(false,"")) {}
352 
353  std::string dofName;
354  std::string basisType;
359  std::pair<bool,std::string> residualName;
360  std::string scatterName;
361  std::pair<bool,std::string> grad;
362  std::pair<bool,std::string> curl;
363  std::pair<bool,std::string> div;
364  std::pair<bool,std::string> timeDerivative;
365 
366  void print(std::ostream & os) const {
367  os << "DOF Desc = \"" << dofName << "\": "
368  << "Basis = (" << basisType << ", \"" << basisOrder << "\"), "
369  << "Res = (" << residualName.first << ", \"" << residualName.second << "\"), "
370  << "Grad = (" << grad.first << ", \"" << grad.second << "\"), "
371  << "Curl = (" << curl.first << ", \"" << curl.second << "\"), "
372  << "Div = (" << div.first << ", \"" << div.second << "\"), "
373  << "Time = (" << timeDerivative.first << ", \"" << timeDerivative.second << "\")";
374  }
375  };
376 
378  std::map<std::string,DOFDescriptor> m_provided_dofs_desc;
379 
380  // Tangent parameter names for setting up tangent fields
381  std::vector<std::string> m_tangent_param_names;
382 
383  private:
384 
386  typedef typename std::map<std::string,DOFDescriptor>::const_iterator DescriptorIterator;
387 
388 
399  std::map<std::string,std::pair<Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<std::vector<std::string> > > > m_basis_to_dofs;
400 
402  typedef typename std::map<std::string,std::pair<Teuchos::RCP<panzer::PureBasis>,Teuchos::RCP<std::vector<std::string> > > >::const_iterator BasisIterator;
403 
408 
410  std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > > m_provided_dofs;
411 
413  std::vector<std::pair<std::string,Teuchos::RCP<panzer::PureBasis> > > m_provided_coord_prefixes;
414 
416  std::map<int,Teuchos::RCP<panzer::IntegrationRule> > m_int_rules;
417 
419  std::map<std::string,Teuchos::RCP<panzer::PureBasis> > m_unique_bases;
420 
422 
423  std::string m_block_id;
424  std::string m_type;
425  std::vector<std::string> m_closure_model_ids;
426 
427  std::vector<std::vector<std::string> > m_coordinate_dofs;
428 
429  };
430 
431 }
432 
433 #endif
void buildAndRegisterResidualSummationEvaluator(PHX::FieldManager< panzer::Traits > &fm, const std::string dof_name, const std::vector< std::string > &residual_contributions, const std::string residual_field_name="") const
Teuchos::RCP< panzer::IntegrationRule > getIntRuleForDOF(const std::string &dof_name) const
Returns the integration rule associated with the residual contributions for the dof_name.
std::map< std::string, DOFDescriptor >::const_iterator DescriptorIterator
For convenience, declare the DOFDescriptor iterator.
void addDOFGrad(const std::string &dofName, const std::string &gradName="")
virtual void setTangentParamNames(const std::vector< std::string > &tangent_param_names)
Set the list of tangent parameter names.
virtual std::string getType() const
Returns the type of the equation set object. Corresponds to the keyword used by the equation set fact...
int getIntegrationOrder(const std::string &dofName) const
Get the integration order for an existing degree of freedom.
Default implementation for accessing the GlobalData object.
virtual const std::map< int, Teuchos::RCP< panzer::IntegrationRule > > & getIntegrationRules() const
Return a map of unique integration rules for the equation set, key is the integration order...
std::map< std::string, Teuchos::RCP< panzer::PureBasis > > m_unique_bases
Key is the basis name from panzer::PureBasis::name() and value is the corresponding PureBasis...
virtual void buildAndRegisterInitialConditionEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::FieldLibrary &fl, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const std::string &model_name, const Teuchos::ParameterList &models, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
Teuchos::RCP< Teuchos::ParameterList > m_eval_plist
virtual void buildAndRegisterDOFProjectionsToIPEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::FieldLayoutLibrary &fl, const Teuchos::RCP< panzer::IntegrationRule > &ir, const Teuchos::Ptr< const panzer::LinearObjFactory< panzer::Traits > > &lof, const Teuchos::ParameterList &user_data) const
int getBasisOrder(const std::string &dofName) const
Get the basis order for an existing degree of freedom.
std::map< std::string, std::pair< Teuchos::RCP< panzer::PureBasis >, Teuchos::RCP< std::vector< std::string > > > > m_basis_to_dofs
Map that links a common basis to a vector of dof names. Key is the unique basis name, the value is a pair that contains an RCP to a basis and an RCP to a vector of dof names that share the basis.
std::map< int, Teuchos::RCP< panzer::IntegrationRule > > m_int_rules
Key is the integration rule order and the value is the corresponding integration rule.
Teuchos::RCP< panzer::PureBasis > getBasisForDOF(const std::string &dof_name) const
Returns the PureBasis associated with the residual contributions for the dof_name.
void setDefaultValidParameters(Teuchos::ParameterList &valid_parameters)
Teuchos::RCP< Teuchos::ParameterList > getEquationSetParameterList() const
Returns the parameter list used to build this equation set.
void setCoordinateDOFs(const std::vector< std::string > &dofNames)
Data for determining cell topology and dimensionality.
void addDOFDiv(const std::string &dofName, const std::string &divName="")
virtual const Teuchos::RCP< Teuchos::ParameterList > getEvaluatorParameterList() const
Returns the parameter list that will be passed off from the equaiton set to the closure model evaluat...
virtual void setupDOFs()
Builds the integration rule, basis, DOFs, and default parameter list. This MUST be called in the cons...
std::map< std::string, std::pair< Teuchos::RCP< panzer::PureBasis >, Teuchos::RCP< std::vector< std::string > > > >::const_iterator BasisIterator
For convenience, declare a basis iterator.
std::map< std::string, DOFDescriptor > m_provided_dofs_desc
Maps the dof name into a DOFDescriptor. Should be private, but is protected so that the aux equaiton ...
void addDOF(const std::string &dofName, const std::string &basisType, const int &basisOrder, const int integrationOrder=-1, const std::string residualName="", const std::string scatterName="")
void updateDOF(const std::string &dofName, int basisOrder, int integrationOrder=-1)
Modifying an existing DOF&#39;s basis function and integration rule.
virtual void buildAndRegisterClosureModelEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::FieldLayoutLibrary &fl, const Teuchos::RCP< panzer::IntegrationRule > &ir, const panzer::ClosureModelFactory_TemplateManager< panzer::Traits > &factory, const Teuchos::ParameterList &models, const Teuchos::ParameterList &user_data) const
Register closure model evaluators with the model name internally specified by the equation set...
std::vector< std::vector< std::string > > m_coordinate_dofs
Teuchos::RCP< panzer::BasisIRLayout > getBasisIRLayoutForDOF(const std::string &dof_name) const
Returns the BasisIRLayout for the dof_name.
virtual void buildAndRegisterGatherAndOrientationEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::FieldLibrary &fl, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
std::vector< std::pair< std::string, Teuchos::RCP< panzer::PureBasis > > > m_provided_coord_prefixes
Key is the coordinate prefix name and the value is the corresponding basis.
const Teuchos::RCP< Teuchos::ParameterList > m_input_params
void getAddedDOFs(std::vector< std::string > &dofNames) const
virtual const std::vector< std::pair< std::string, Teuchos::RCP< panzer::PureBasis > > > & getProvidedDOFs() const
Return the Basis for the equation set, key is the DOF name (note coordinate DOFs are NOT included) ...
virtual const std::vector< std::vector< std::string > > & getCoordinateDOFs() const
Return a vector of vectors that correspond to DOFs set as coordinate fields.
void addDOFTimeDerivative(const std::string &dofName, const std::string &dotName="")
bool buildTransientSupport() const
Returns true if transient support should be enabled in the equation set.
virtual void buildAndRegisterScatterEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::FieldLibrary &fl, const LinearObjFactory< panzer::Traits > &lof, const Teuchos::ParameterList &user_data) const
void addDOFCurl(const std::string &dofName, const std::string &curlName="")
EquationSet_DefaultImpl(const Teuchos::RCP< Teuchos::ParameterList > &params, const int &default_integration_order, const panzer::CellData &cell_data, const Teuchos::RCP< panzer::GlobalData > &global_data, const bool build_transient_support)
virtual void setElementBlockId(const std::string &blockId)
std::vector< std::pair< std::string, Teuchos::RCP< panzer::PureBasis > > > m_provided_dofs
Key is the dof name and the value is the corresponding basis.
virtual void buildAndRegisterEquationSetEvaluators(PHX::FieldManager< panzer::Traits > &fm, const panzer::FieldLibrary &fl, const Teuchos::ParameterList &user_data) const =0
void addClosureModel(const std::string &closure_model)