www.mooseframework.org
Coupleable.C
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 #include "Coupleable.h"
16 #include "Problem.h"
17 #include "SubProblem.h"
18 #include "FEProblem.h"
19 #include "MooseVariable.h"
20 #include "InputParameters.h"
21 #include "MooseObject.h"
22 
23 Coupleable::Coupleable(const MooseObject * moose_object, bool nodal)
24  : _c_parameters(moose_object->parameters()),
25  _c_fe_problem(*_c_parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
26  _c_nodal(nodal),
27  _c_is_implicit(_c_parameters.have_parameter<bool>("implicit")
28  ? _c_parameters.get<bool>("implicit")
29  : true),
30  _coupleable_params(_c_parameters),
31  _coupleable_neighbor(_c_parameters.have_parameter<bool>("_neighbor")
32  ? _c_parameters.get<bool>("_neighbor")
33  : false),
34  _coupleable_max_qps(_c_fe_problem.getMaxQps())
35 {
36  SubProblem & problem = *_c_parameters.get<SubProblem *>("_subproblem");
37 
38  THREAD_ID tid = _c_parameters.get<THREAD_ID>("_tid");
39 
40  // Coupling
41  for (std::set<std::string>::const_iterator iter = _c_parameters.coupledVarsBegin();
42  iter != _c_parameters.coupledVarsEnd();
43  ++iter)
44  {
45  std::string name = *iter;
46  if (_c_parameters.getVecMooseType(name) != std::vector<std::string>())
47  {
48  std::vector<std::string> vars = _c_parameters.getVecMooseType(*iter);
49  for (const auto & coupled_var_name : vars)
50  {
51  if (problem.hasVariable(coupled_var_name))
52  {
53  MooseVariable * moose_var = &problem.getVariable(tid, coupled_var_name);
54  _coupled_vars[name].push_back(moose_var);
55  _coupled_moose_vars.push_back(moose_var);
56  }
57  else if (problem.hasScalarVariable(coupled_var_name))
58  ; // ignore scalar variables
59  else
60  mooseError("Coupled variable '" + coupled_var_name + "' was not found\n");
61  }
62  }
63  else // This means it was optional coupling. Let's assign a unique id to this variable
64  _optional_var_index[name] =
65  std::numeric_limits<unsigned int>::max() - _optional_var_index.size();
66  }
67 
71 }
72 
74 {
75  for (auto & it : _default_value)
76  {
77  it.second->release();
78  delete it.second;
79  }
83 }
84 
85 void
86 Coupleable::coupledCallback(const std::string & /*var_name*/, bool /*is_old*/)
87 {
88 }
89 
90 bool
91 Coupleable::isCoupled(const std::string & var_name, unsigned int i)
92 {
93  std::map<std::string, std::vector<MooseVariable *>>::iterator it = _coupled_vars.find(var_name);
94  if (it != _coupled_vars.end())
95  return (i < it->second.size());
96  else
97  {
98  // Make sure the user originally requested this value in the InputParameter syntax
99  if (!_coupleable_params.hasCoupledValue(var_name))
100  mooseError("The coupled variable \"",
101  var_name,
102  "\" was never added to this objects's "
103  "InputParameters, please double-check your "
104  "spelling");
105 
106  return false;
107  }
108 }
109 
110 unsigned int
111 Coupleable::coupledComponents(const std::string & var_name)
112 {
113  return _coupled_vars[var_name].size();
114 }
115 
117 Coupleable::getVar(const std::string & var_name, unsigned int comp)
118 {
119  if (_coupled_vars.find(var_name) != _coupled_vars.end())
120  {
121  if (comp < _coupled_vars[var_name].size())
122  {
123  // Error check - don't couple elemental to nodal
124  if (!(_coupled_vars[var_name][comp])->isNodal() && _c_nodal)
125  mooseError("You cannot couple an elemental variable to a nodal variable");
126  return _coupled_vars[var_name][comp];
127  }
128  else
129  mooseError("Trying to get a non-existent component of variable '" + var_name + "'");
130  }
131  else
132  mooseError("Trying to get a non-existent variable '" + var_name + "'");
133 }
134 
135 unsigned int
136 Coupleable::coupled(const std::string & var_name, unsigned int comp)
137 {
138  if (!isCoupled(var_name))
139  return _optional_var_index[var_name];
140 
141  MooseVariable * var = getVar(var_name, comp);
142  switch (var->kind())
143  {
145  return var->number();
147  return std::numeric_limits<unsigned int>::max() - var->number();
148  }
149  mooseError("Unknown variable kind. Corrupted binary?");
150 }
151 
153 Coupleable::getDefaultValue(const std::string & var_name)
154 {
155  std::map<std::string, VariableValue *>::iterator default_value_it = _default_value.find(var_name);
156  if (default_value_it == _default_value.end())
157  {
158  VariableValue * value =
160  default_value_it = _default_value.insert(std::make_pair(var_name, value)).first;
161  }
162 
163  return default_value_it->second;
164 }
165 
166 const VariableValue &
167 Coupleable::coupledValue(const std::string & var_name, unsigned int comp)
168 {
169  if (!isCoupled(var_name))
170  return *getDefaultValue(var_name);
171 
172  coupledCallback(var_name, false);
173  MooseVariable * var = getVar(var_name, comp);
174 
176  {
177  if (_c_nodal)
178  return (_c_is_implicit) ? var->nodalSln() : var->nodalSlnOld();
179  else
180  return (_c_is_implicit) ? var->sln() : var->slnOld();
181  }
182  else
183  {
184  if (_c_nodal)
185  return (_c_is_implicit) ? var->nodalSlnNeighbor() : var->nodalSlnOldNeighbor();
186  else
187  return (_c_is_implicit) ? var->slnNeighbor() : var->slnOldNeighbor();
188  }
189 }
190 
192 Coupleable::writableCoupledValue(const std::string & var_name, unsigned int comp)
193 {
194  return const_cast<VariableValue &>(coupledValue(var_name, comp));
195 }
196 
197 const VariableValue &
198 Coupleable::coupledValueOld(const std::string & var_name, unsigned int comp)
199 {
200  if (!isCoupled(var_name))
201  return *getDefaultValue(var_name);
202 
203  validateExecutionerType(var_name);
204  coupledCallback(var_name, true);
205  MooseVariable * var = getVar(var_name, comp);
206 
208  {
209  if (_c_nodal)
210  return (_c_is_implicit) ? var->nodalSlnOld() : var->nodalSlnOlder();
211  else
212  return (_c_is_implicit) ? var->slnOld() : var->slnOlder();
213  }
214  else
215  {
216  if (_c_nodal)
217  return (_c_is_implicit) ? var->nodalSlnOldNeighbor() : var->nodalSlnOlderNeighbor();
218  else
219  return (_c_is_implicit) ? var->slnOldNeighbor() : var->slnOlderNeighbor();
220  }
221 }
222 
223 const VariableValue &
224 Coupleable::coupledValueOlder(const std::string & var_name, unsigned int comp)
225 {
226  if (!isCoupled(var_name))
227  return *getDefaultValue(var_name);
228 
229  validateExecutionerType(var_name);
230  coupledCallback(var_name, true);
231  MooseVariable * var = getVar(var_name, comp);
232 
234  {
235  if (_c_nodal)
236  {
237  if (_c_is_implicit)
238  return var->nodalSlnOlder();
239  else
240  mooseError("Older values not available for explicit schemes");
241  }
242  else
243  {
244  if (_c_is_implicit)
245  return var->slnOlder();
246  else
247  mooseError("Older values not available for explicit schemes");
248  }
249  }
250  else
251  {
252  if (_c_nodal)
253  {
254  if (_c_is_implicit)
255  return var->nodalSlnOlderNeighbor();
256  else
257  mooseError("Older values not available for explicit schemes");
258  }
259  else
260  {
261  if (_c_is_implicit)
262  return var->slnOlderNeighbor();
263  else
264  mooseError("Older values not available for explicit schemes");
265  }
266  }
267 }
268 
269 const VariableValue &
270 Coupleable::coupledValuePreviousNL(const std::string & var_name, unsigned int comp)
271 {
272  if (!isCoupled(var_name))
273  return *getDefaultValue(var_name);
274 
276  coupledCallback(var_name, true);
277  MooseVariable * var = getVar(var_name, comp);
278 
280  {
281  if (_c_nodal)
282  return var->nodalSlnPreviousNL();
283  else
284  return var->slnPreviousNL();
285  }
286  else
287  {
288  if (_c_nodal)
289  return var->nodalSlnPreviousNLNeighbor();
290  else
291  return var->slnPreviousNLNeighbor();
292  }
293 }
294 
295 const VariableValue &
296 Coupleable::coupledDot(const std::string & var_name, unsigned int comp)
297 {
298  if (!isCoupled(var_name)) // Return default 0
299  return _default_value_zero;
300 
301  MooseVariable * var = getVar(var_name, comp);
302 
304  {
305  if (_c_nodal)
306  return var->nodalSlnDot();
307  else
308  return var->uDot();
309  }
310  else
311  {
312  if (_c_nodal)
313  return var->nodalSlnDotNeighbor();
314  else
315  return var->uDotNeighbor();
316  }
317 }
318 
319 const VariableValue &
320 Coupleable::coupledDotDu(const std::string & var_name, unsigned int comp)
321 {
322  if (!isCoupled(var_name)) // Return default 0
323  return _default_value_zero;
324 
325  MooseVariable * var = getVar(var_name, comp);
326 
328  {
329  if (_c_nodal)
330  return var->nodalSlnDuDotDu();
331  else
332  return var->duDotDu();
333  }
334  else
335  {
336  if (_c_nodal)
337  return var->nodalSlnDuDotDu();
338  else
339  return var->duDotDu();
340  }
341 }
342 
343 const VariableGradient &
344 Coupleable::coupledGradient(const std::string & var_name, unsigned int comp)
345 {
346  if (!isCoupled(var_name)) // Return default 0
347  return _default_gradient;
348 
349  coupledCallback(var_name, false);
350  if (_c_nodal)
351  mooseError("Nodal variables do not have gradients");
352 
353  MooseVariable * var = getVar(var_name, comp);
354 
356  return (_c_is_implicit) ? var->gradSln() : var->gradSlnOld();
357  else
358  return (_c_is_implicit) ? var->gradSlnNeighbor() : var->gradSlnOldNeighbor();
359 }
360 
361 const VariableGradient &
362 Coupleable::coupledGradientOld(const std::string & var_name, unsigned int comp)
363 {
364  if (!isCoupled(var_name)) // Return default 0
365  return _default_gradient;
366 
367  coupledCallback(var_name, true);
368  if (_c_nodal)
369  mooseError("Nodal variables do not have gradients");
370 
371  validateExecutionerType(var_name);
372  MooseVariable * var = getVar(var_name, comp);
373 
375  return (_c_is_implicit) ? var->gradSlnOld() : var->gradSlnOlder();
376  else
377  return (_c_is_implicit) ? var->gradSlnOldNeighbor() : var->gradSlnOlderNeighbor();
378 }
379 
380 const VariableGradient &
381 Coupleable::coupledGradientOlder(const std::string & var_name, unsigned int comp)
382 {
383  if (!isCoupled(var_name)) // Return default 0
384  return _default_gradient;
385 
386  coupledCallback(var_name, true);
387  if (_c_nodal)
388  mooseError("Nodal variables do not have gradients");
389 
390  validateExecutionerType(var_name);
391  MooseVariable * var = getVar(var_name, comp);
392 
393  if (_c_is_implicit)
394  {
396  return var->gradSlnOlder();
397  else
398  return var->gradSlnOlderNeighbor();
399  }
400  else
401  mooseError("Older values not available for explicit schemes");
402 }
403 
404 const VariableGradient &
405 Coupleable::coupledGradientPreviousNL(const std::string & var_name, unsigned int comp)
406 {
407  if (!isCoupled(var_name)) // Return default 0
408  return _default_gradient;
409 
411  coupledCallback(var_name, true);
412  if (_c_nodal)
413  mooseError("Nodal variables do not have gradients");
414 
415  MooseVariable * var = getVar(var_name, comp);
416 
418  return var->gradSlnPreviousNL();
419  else
420  return var->gradSlnPreviousNLNeighbor();
421 }
422 
423 const VariableSecond &
424 Coupleable::coupledSecond(const std::string & var_name, unsigned int comp)
425 {
426  if (!isCoupled(var_name)) // Return default 0
427  return _default_second;
428 
429  coupledCallback(var_name, false);
430  if (_c_nodal)
431  mooseError("Nodal variables do not have second derivatives");
432 
433  MooseVariable * var = getVar(var_name, comp);
434 
436  return (_c_is_implicit) ? var->secondSln() : var->secondSlnOlder();
437  else
438  return (_c_is_implicit) ? var->secondSlnNeighbor() : var->secondSlnOlderNeighbor();
439 }
440 
441 const VariableSecond &
442 Coupleable::coupledSecondOld(const std::string & var_name, unsigned int comp)
443 {
444  if (!isCoupled(var_name)) // Return default 0
445  return _default_second;
446 
447  coupledCallback(var_name, true);
448  if (_c_nodal)
449  mooseError("Nodal variables do not have second derivatives");
450 
451  validateExecutionerType(var_name);
452  MooseVariable * var = getVar(var_name, comp);
454  return (_c_is_implicit) ? var->secondSlnOld() : var->secondSlnOlder();
455  else
457 }
458 
459 const VariableSecond &
460 Coupleable::coupledSecondOlder(const std::string & var_name, unsigned int comp)
461 {
462  if (!isCoupled(var_name)) // Return default 0
463  return _default_second;
464 
465  coupledCallback(var_name, true);
466  if (_c_nodal)
467  mooseError("Nodal variables do not have second derivatives");
468 
469  validateExecutionerType(var_name);
470  MooseVariable * var = getVar(var_name, comp);
471  if (_c_is_implicit)
472  {
474  return var->secondSlnOlder();
475  else
476  return var->secondSlnOlderNeighbor();
477  }
478  else
479  mooseError("Older values not available for explicit schemes");
480 }
481 
482 const VariableSecond &
483 Coupleable::coupledSecondPreviousNL(const std::string & var_name, unsigned int comp)
484 {
485  if (!isCoupled(var_name)) // Return default 0
486  return _default_second;
487 
489  coupledCallback(var_name, true);
490  if (_c_nodal)
491  mooseError("Nodal variables do not have second derivatives");
492 
493  MooseVariable * var = getVar(var_name, comp);
495  return var->secondSlnPreviousNL();
496  else
497  return var->secondSlnPreviousNLNeighbor();
498 }
499 
500 const VariableValue &
501 Coupleable::coupledNodalValue(const std::string & var_name, unsigned int comp)
502 {
503  if (!isCoupled(var_name))
504  return *getDefaultValue(var_name);
505 
506  coupledCallback(var_name, false);
507  MooseVariable * var = getVar(var_name, comp);
508 
510  return (_c_is_implicit) ? var->nodalValue() : var->nodalValueOld();
511  else
512  return (_c_is_implicit) ? var->nodalValueNeighbor() : var->nodalValueOldNeighbor();
513 }
514 
515 const VariableValue &
516 Coupleable::coupledNodalValueOld(const std::string & var_name, unsigned int comp)
517 {
518  if (!isCoupled(var_name))
519  return *getDefaultValue(var_name);
520 
521  validateExecutionerType(var_name);
522  coupledCallback(var_name, true);
523  MooseVariable * var = getVar(var_name, comp);
524 
526  return (_c_is_implicit) ? var->nodalValueOld() : var->nodalValueOlder();
527  else
529 }
530 
531 const VariableValue &
532 Coupleable::coupledNodalValueOlder(const std::string & var_name, unsigned int comp)
533 {
534  if (!isCoupled(var_name))
535  return *getDefaultValue(var_name);
536 
537  validateExecutionerType(var_name);
538  coupledCallback(var_name, true);
539  MooseVariable * var = getVar(var_name, comp);
540  if (_c_is_implicit)
541  {
543  return var->nodalValueOlder();
544  else
545  return var->nodalValueOlderNeighbor();
546  }
547  else
548  mooseError("Older values not available for explicit schemes");
549 }
550 
551 const VariableValue &
552 Coupleable::coupledNodalValuePreviousNL(const std::string & var_name, unsigned int comp)
553 {
554  if (!isCoupled(var_name))
555  return *getDefaultValue(var_name);
556 
558  coupledCallback(var_name, true);
559  MooseVariable * var = getVar(var_name, comp);
560 
562  return var->nodalValuePreviousNL();
563  else
564  return var->nodalValuePreviousNLNeighbor();
565 }
566 
567 const VariableValue &
568 Coupleable::coupledNodalDot(const std::string & var_name, unsigned int comp)
569 {
570  if (!isCoupled(var_name)) // Return default 0
571  return _default_value_zero;
572 
573  coupledCallback(var_name, false);
574  MooseVariable * var = getVar(var_name, comp);
575 
577  return var->nodalValueDot();
578  else
579  return var->nodalValueDotNeighbor();
580 }
581 
582 const DenseVector<Number> &
583 Coupleable::coupledSolutionDoFs(const std::string & var_name, unsigned int comp)
584 {
585  // default coupling is not available for elemental solutions
586  if (!isCoupled(var_name))
587  mooseError("invalid variable name for coupledSolutionDoFs");
588 
589  if (_c_nodal)
590  mooseError("nodal objects should not call coupledSolutionDoFs");
591 
592  coupledCallback(var_name, false);
593  MooseVariable * var = getVar(var_name, comp);
594 
596  return (_c_is_implicit) ? var->solutionDoFs() : var->solutionDoFsOld();
597  else
599 }
600 
601 const DenseVector<Number> &
602 Coupleable::coupledSolutionDoFsOld(const std::string & var_name, unsigned int comp)
603 {
604  // default coupling is not available for elemental solutions
605  if (!isCoupled(var_name))
606  mooseError("invalid variable name for coupledSolutionDoFsOld");
607 
608  if (_c_nodal)
609  mooseError("nodal objects should not call coupledSolutionDoFsOld");
610 
611  validateExecutionerType(var_name);
612  coupledCallback(var_name, true);
613  MooseVariable * var = getVar(var_name, comp);
614 
616  return (_c_is_implicit) ? var->solutionDoFsOld() : var->solutionDoFsOlder();
617  else
619 }
620 
621 const DenseVector<Number> &
622 Coupleable::coupledSolutionDoFsOlder(const std::string & var_name, unsigned int comp)
623 {
624  // default coupling is not available for elemental solutions
625  if (!isCoupled(var_name))
626  mooseError("invalid variable name for coupledSolutionDoFsOlder");
627 
628  if (_c_nodal)
629  mooseError("nodal objects should not call coupledSolutionDoFsOlder");
630 
631  validateExecutionerType(var_name);
632  coupledCallback(var_name, true);
633  MooseVariable * var = getVar(var_name, comp);
634  if (_c_is_implicit)
635  {
637  return var->solutionDoFsOlder();
638  else
639  return var->solutionDoFsOlderNeighbor();
640  }
641  else
642  mooseError("Older values not available for explicit schemes");
643 }
644 
645 void
646 Coupleable::validateExecutionerType(const std::string & name) const
647 {
648  if (!_c_fe_problem.isTransient())
649  mooseError("You may not couple in old or older values of \"",
650  name,
651  "\" when using a \"Steady\" executioner.");
652 }
const VariableGradient & gradSlnNeighbor()
virtual bool hasVariable(const std::string &var_name)=0
void validateExecutionerType(const std::string &name) const
Checks to make sure that the current Executioner has set "_it_transient" when old/older values are co...
Definition: Coupleable.C:646
const VariableSecond & secondSlnOldNeighbor()
bool _c_nodal
True if we provide coupling to nodal values.
Definition: Coupleable.h:327
const VariableSecond & secondSlnPreviousNL()
const VariableGradient & gradSlnOld()
std::vector< MooseVariable * > _coupled_moose_vars
Vector of coupled variables.
Definition: Coupleable.h:324
const VariableValue & nodalValue()
unsigned int coupledComponents(const std::string &var_name)
Number of coupled components.
Definition: Coupleable.C:111
const DenseVector< Number > & solutionDoFsOld()
Class for stuff related to variables.
Definition: MooseVariable.h:43
const VariableValue & slnOlder()
bool hasCoupledValue(const std::string &coupling_name) const
Return whether or not the coupled variable exists.
std::set< std::string >::const_iterator coupledVarsEnd() const
const VariableValue & nodalValueNeighbor()
MooseArray< Real > VariableValue
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name)=0
Returns the variable reference for requested variable which may be in any system. ...
void resize(const unsigned int size)
Change the number of elements the array can store.
Definition: MooseArray.h:205
const DenseVector< Number > & solutionDoFsNeighbor()
std::vector< std::string > getVecMooseType(const std::string &name) const
virtual const DenseVector< Number > & coupledSolutionDoFsOld(const std::string &var_name, unsigned int comp=0)
Returns DoFs in the old solution vector of a coupled variable for the local element.
Definition: Coupleable.C:602
Moose::VarKindType kind() const
Kind of the variable (Nonlinear, Auxiliary, ...)
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
const VariableSecond & secondSln()
const VariableGradient & gradSlnOldNeighbor()
const VariableValue & nodalSlnPreviousNL()
const VariableValue & uDotNeighbor()
const VariableValue & slnPreviousNLNeighbor()
const VariableValue & nodalSlnNeighbor()
virtual const VariableValue & coupledNodalValuePreviousNL(const std::string &var_name, unsigned int comp=0)
Returns nodal values of a coupled variable for previous Newton iterate.
Definition: Coupleable.C:552
VariableValue _default_value_zero
This will always be zero because the default values for optionally coupled variables is always consta...
Definition: Coupleable.h:339
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled variable.
Definition: Coupleable.C:117
virtual const VariableValue & coupledValuePreviousNL(const std::string &var_name, unsigned int comp=0)
Returns value of previous Newton iterate of a coupled variable.
Definition: Coupleable.C:270
VariableValue * getDefaultValue(const std::string &var_name)
Helper method to return (and insert if necessary) the default value for an uncoupled variable...
Definition: Coupleable.C:153
const VariableGradient & gradSlnPreviousNLNeighbor()
const VariableSecond & secondSlnOld()
const VariableSecond & secondSlnOlder()
virtual VariableValue & writableCoupledValue(const std::string &var_name, unsigned int comp=0)
Returns a writable reference to a coupled variable.
Definition: Coupleable.C:192
virtual const VariableValue & coupledNodalValueOlder(const std::string &var_name, unsigned int comp=0)
Returns an old nodal value from two time steps previous of a coupled variable.
Definition: Coupleable.C:532
virtual const VariableSecond & coupledSecondOlder(const std::string &var_name, unsigned int comp=0)
Returns an old second derivative from two time steps previous of a coupled variable.
Definition: Coupleable.C:460
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const VariableValue & nodalValuePreviousNL()
const DenseVector< Number > & solutionDoFs()
std::map< std::string, std::vector< MooseVariable * > > _coupled_vars
Coupled vars whose values we provide.
Definition: Coupleable.h:321
const VariableValue & nodalSlnDot()
const VariableValue & nodalValueDotNeighbor()
Coupleable(const MooseObject *moose_object, bool nodal)
Constructing the object.
Definition: Coupleable.C:23
FEProblemBase & _c_fe_problem
Definition: Coupleable.h:318
bool _c_is_implicit
True if implicit value is required.
Definition: Coupleable.h:330
virtual bool isCoupled(const std::string &var_name, unsigned int i=0)
Returns true if a variables has been coupled as name.
Definition: Coupleable.C:91
const DenseVector< Number > & solutionDoFsOlder()
const VariableValue & nodalSlnOldNeighbor()
virtual void coupledCallback(const std::string &var_name, bool is_old)
Definition: Coupleable.C:86
const VariableValue & nodalSlnPreviousNLNeighbor()
const VariableValue & nodalValueOldNeighbor()
const VariableValue & slnOld()
virtual const VariableValue & coupledNodalDot(const std::string &var_name, unsigned int comp=0)
Nodal values of time derivative of a coupled variable.
Definition: Coupleable.C:568
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
virtual const VariableGradient & coupledGradientOlder(const std::string &var_name, unsigned int comp=0)
Returns an old gradient from two time steps previous of a coupled variable.
Definition: Coupleable.C:381
const VariableValue & nodalSlnOlderNeighbor()
const VariableGradient & gradSlnPreviousNL()
virtual const DenseVector< Number > & coupledSolutionDoFsOlder(const std::string &var_name, unsigned int comp=0)
Returns DoFs in the older solution vector of a coupled variable for the local element.
Definition: Coupleable.C:622
virtual const VariableValue & coupledNodalValue(const std::string &var_name, unsigned int comp=0)
Returns nodal values of a coupled variable.
Definition: Coupleable.C:501
const InputParameters & _coupleable_params
Local InputParameters.
Definition: Coupleable.h:333
void needsPreviousNewtonIteration(bool state)
Set a flag that indicated that user required values for the previous Newton iterate.
const VariableValue & nodalSlnOld()
virtual ~Coupleable()
Destructor for object.
Definition: Coupleable.C:73
virtual bool isTransient() const override
const VariableValue & slnOlderNeighbor()
const VariableValue & duDotDu()
const VariableSecond & secondSlnOlderNeighbor()
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0)
Returns value of a coupled variable.
Definition: Coupleable.C:167
const VariableValue & nodalSlnOlder()
const VariableGradient & gradSlnOlderNeighbor()
Real defaultCoupledValue(const std::string &coupling_name) const
Get the default value for an optionally coupled variable.
const VariableValue & slnOldNeighbor()
const VariableValue & nodalValueOld()
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
virtual const VariableValue & coupledValueOld(const std::string &var_name, unsigned int comp=0)
Returns an old value from previous time step of a coupled variable.
Definition: Coupleable.C:198
unsigned int number() const
Get variable number coming from libMesh.
const VariableValue & nodalSln()
const VariableValue & nodalSlnDuDotDu()
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
void release()
Manually deallocates the data pointer.
Definition: MooseArray.h:56
virtual const VariableValue & coupledNodalValueOld(const std::string &var_name, unsigned int comp=0)
Returns an old nodal value from previous time step of a coupled variable.
Definition: Coupleable.C:516
const VariableValue & nodalValueOlderNeighbor()
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0)
Returns gradient of a coupled variable.
Definition: Coupleable.C:344
const VariableValue & sln()
const VariableValue & uDot()
virtual const VariableSecond & coupledSecond(const std::string &var_name, unsigned int comp=0)
Returns second derivative of a coupled variable.
Definition: Coupleable.C:424
const DenseVector< Number > & solutionDoFsOlderNeighbor()
const VariableValue & nodalSlnDotNeighbor()
const VariableGradient & gradSlnOlder()
std::set< std::string >::const_iterator coupledVarsBegin() const
Methods returning iterators to the coupled variables names stored in this InputParameters object...
const VariableValue & nodalValuePreviousNLNeighbor()
const DenseVector< Number > & solutionDoFsOldNeighbor()
virtual const VariableGradient & coupledGradientPreviousNL(const std::string &var_name, unsigned int comp=0)
Returns gradient of a coupled variable for previous Newton iterate.
Definition: Coupleable.C:405
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
const VariableValue & slnNeighbor()
virtual const VariableSecond & coupledSecondOld(const std::string &var_name, unsigned int comp=0)
Returns an old second derivative from previous time step of a coupled variable.
Definition: Coupleable.C:442
const VariableSecond & secondSlnPreviousNLNeighbor()
virtual const DenseVector< Number > & coupledSolutionDoFs(const std::string &var_name, unsigned int comp=0)
Returns DoFs in the current solution vector of a coupled variable for the local element.
Definition: Coupleable.C:583
virtual const VariableSecond & coupledSecondPreviousNL(const std::string &var_name, unsigned int comp=0)
Returns second derivative of a coupled variable for the previous Newton iterate.
Definition: Coupleable.C:483
virtual bool hasScalarVariable(const std::string &var_name)=0
Returns a Boolean indicating whether any system contains a variable with the name provided...
virtual const VariableValue & coupledDotDu(const std::string &var_name, unsigned int comp=0)
Time derivative of a coupled variable with respect to the coefficients.
Definition: Coupleable.C:320
const VariableSecond & secondSlnNeighbor()
unsigned int _coupleable_max_qps
Maximum qps for any element in this system.
Definition: Coupleable.h:375
virtual const VariableValue & coupledDot(const std::string &var_name, unsigned int comp=0)
Time derivative of a coupled variable.
Definition: Coupleable.C:296
const VariableGradient & gradSln()
const VariableValue & nodalValueDot()
const VariableValue & nodalValueOlder()
virtual const VariableGradient & coupledGradientOld(const std::string &var_name, unsigned int comp=0)
Returns an old gradient from previous time step of a coupled variable.
Definition: Coupleable.C:362
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0)
Returns the index for a coupled variable by name.
Definition: Coupleable.C:136
const VariableValue & slnPreviousNL()
virtual const VariableValue & coupledValueOlder(const std::string &var_name, unsigned int comp=0)
Returns an old value from two time steps previous of a coupled variable.
Definition: Coupleable.C:224
unsigned int THREAD_ID
Definition: MooseTypes.h:79