www.mooseframework.org
Coupleable.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef COUPLEABLE_H
16 #define COUPLEABLE_H
17 
18 // MOOSE includes
19 #include "MooseVariableBase.h"
20 
21 // Forward declarations
22 class InputParameters;
23 class MooseVariable;
24 class MooseObject;
25 namespace libMesh
26 {
27 template <typename T>
29 }
30 
36 {
37 public:
43  Coupleable(const MooseObject * moose_object, bool nodal);
44 
48  virtual ~Coupleable();
49 
54  const std::map<std::string, std::vector<MooseVariable *>> & getCoupledVars()
55  {
56  return _coupled_vars;
57  }
58 
63  const std::vector<MooseVariable *> & getCoupledMooseVars() const { return _coupled_moose_vars; }
64 
65 protected:
72  virtual bool isCoupled(const std::string & var_name, unsigned int i = 0);
73 
79  unsigned int coupledComponents(const std::string & var_name);
80 
81  virtual void coupledCallback(const std::string & var_name, bool is_old);
82 
90  virtual unsigned int coupled(const std::string & var_name, unsigned int comp = 0);
91 
99  virtual const VariableValue & coupledValue(const std::string & var_name, unsigned int comp = 0);
100 
111  virtual VariableValue & writableCoupledValue(const std::string & var_name, unsigned int comp = 0);
112 
120  virtual const VariableValue & coupledValueOld(const std::string & var_name,
121  unsigned int comp = 0);
122 
130  virtual const VariableValue & coupledValueOlder(const std::string & var_name,
131  unsigned int comp = 0);
132 
139  virtual const VariableValue & coupledValuePreviousNL(const std::string & var_name,
140  unsigned int comp = 0);
141 
149  virtual const VariableGradient & coupledGradient(const std::string & var_name,
150  unsigned int comp = 0);
151 
159  virtual const VariableGradient & coupledGradientOld(const std::string & var_name,
160  unsigned int comp = 0);
161 
169  virtual const VariableGradient & coupledGradientOlder(const std::string & var_name,
170  unsigned int comp = 0);
171 
178  virtual const VariableGradient & coupledGradientPreviousNL(const std::string & var_name,
179  unsigned int comp = 0);
180 
188  virtual const VariableSecond & coupledSecond(const std::string & var_name, unsigned int comp = 0);
189 
198  virtual const VariableSecond & coupledSecondOld(const std::string & var_name,
199  unsigned int comp = 0);
200 
209  virtual const VariableSecond & coupledSecondOlder(const std::string & var_name,
210  unsigned int comp = 0);
211 
218  virtual const VariableSecond & coupledSecondPreviousNL(const std::string & var_name,
219  unsigned int comp = 0);
220 
228  virtual const VariableValue & coupledDot(const std::string & var_name, unsigned int comp = 0);
229 
238  virtual const VariableValue & coupledDotDu(const std::string & var_name, unsigned int comp = 0);
239 
246  virtual const VariableValue & coupledNodalValue(const std::string & var_name,
247  unsigned int comp = 0);
248 
255  virtual const VariableValue & coupledNodalValueOld(const std::string & var_name,
256  unsigned int comp = 0);
257 
264  virtual const VariableValue & coupledNodalValueOlder(const std::string & var_name,
265  unsigned int comp = 0);
266 
273  virtual const VariableValue & coupledNodalValuePreviousNL(const std::string & var_name,
274  unsigned int comp = 0);
275 
283  virtual const VariableValue & coupledNodalDot(const std::string & var_name,
284  unsigned int comp = 0);
285 
292  virtual const DenseVector<Number> & coupledSolutionDoFs(const std::string & var_name,
293  unsigned int comp = 0);
294 
301  virtual const DenseVector<Number> & coupledSolutionDoFsOld(const std::string & var_name,
302  unsigned int comp = 0);
303 
310  virtual const DenseVector<Number> & coupledSolutionDoFsOlder(const std::string & var_name,
311  unsigned int comp = 0);
312 
313 protected:
314  // Reference to the interface's input parameters
316 
317  // Reference to FEProblemBase
319 
321  std::map<std::string, std::vector<MooseVariable *>> _coupled_vars;
322 
324  std::vector<MooseVariable *> _coupled_moose_vars;
325 
327  bool _c_nodal;
328 
331 
334 
336  std::map<std::string, VariableValue *> _default_value;
337 
340 
343 
346 
353  MooseVariable * getVar(const std::string & var_name, unsigned int comp);
354 
360  void validateExecutionerType(const std::string & name) const;
361 
364 
365 private:
372  VariableValue * getDefaultValue(const std::string & var_name);
373 
375  unsigned int _coupleable_max_qps;
376 
378  std::map<std::string, unsigned int> _optional_var_index;
379 };
380 
381 #endif /* COUPLEABLE_H */
bool _c_nodal
True if we provide coupling to nodal values.
Definition: Coupleable.h:327
std::vector< MooseVariable * > _coupled_moose_vars
Vector of coupled variables.
Definition: Coupleable.h:324
Class for stuff related to variables.
Definition: MooseVariable.h:43
const std::vector< MooseVariable * > & getCoupledMooseVars() const
Get the list of coupled variables.
Definition: Coupleable.h:63
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
VariableValue _default_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:339
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
std::map< std::string, std::vector< MooseVariable * > > _coupled_vars
Coupled vars whose values we provide.
Definition: Coupleable.h:321
FEProblemBase & _c_fe_problem
Definition: Coupleable.h:318
bool _c_is_implicit
True if implicit value is required.
Definition: Coupleable.h:330
const std::map< std::string, std::vector< MooseVariable * > > & getCoupledVars()
Get the list of coupled variables.
Definition: Coupleable.h:54
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
VariableGradient _default_gradient
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:342
VariableSecond _default_second
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:345
const InputParameters & _coupleable_params
Local InputParameters.
Definition: Coupleable.h:333
bool _coupleable_neighbor
Whether or not this object is a "neighbor" object: ie all of it&#39;s coupled values should be neighbor v...
Definition: Coupleable.h:363
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:35
const InputParameters & _c_parameters
Definition: Coupleable.h:315
std::map< std::string, VariableValue * > _default_value
Will hold the default value for optional coupled variables.
Definition: Coupleable.h:336
std::map< std::string, unsigned int > _optional_var_index
Unique indices for optionally coupled vars that weren&#39;t provided.
Definition: Coupleable.h:378
unsigned int _coupleable_max_qps
Maximum qps for any element in this system.
Definition: Coupleable.h:375