www.mooseframework.org
Transfer.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 // MOOSE includes
16 #include "Transfer.h"
17 #include "FEProblem.h"
18 #include "MooseMesh.h"
19 #include "Assembly.h"
20 #include "MooseVariable.h"
21 #include "MooseEnum.h"
22 #include "InputParameters.h"
23 
24 // libMesh
25 #include "libmesh/system.h"
26 
27 const Number Transfer::OutOfMeshValue = -999999;
28 
29 template <>
32 {
34  params.addParam<bool>("use_displaced_mesh",
35  false,
36  "Whether or not this object should use the "
37  "displaced mesh for computation. Note that "
38  "in the case this is true but no "
39  "displacements are provided in the Mesh block "
40  "the undisplaced mesh will still be used.");
41  // Add the SetupInterface parameter, 'execute_on', and set it to a default of 'timestep_begin'
42  params += validParams<SetupInterface>();
43  params.set<MultiMooseEnum>("execute_on") = "timestep_begin";
44 
45  params.registerBase("Transfer");
46 
47  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
48 
49  params.declareControllable("enable");
50  return params;
51 }
52 
54  : MooseObject(parameters),
55  SetupInterface(this),
56  Restartable(parameters, "Transfers"),
57  _subproblem(*parameters.get<SubProblem *>("_subproblem")),
58  _fe_problem(*parameters.get<FEProblemBase *>("_fe_problem_base")),
59  _sys(*parameters.get<SystemBase *>("_sys")),
60  _tid(parameters.get<THREAD_ID>("_tid"))
61 {
62 }
63 
69 System *
70 Transfer::find_sys(EquationSystems & es, const std::string & var_name)
71 {
72  // Find the system this variable is from
73  for (unsigned int i = 0; i < es.n_systems(); i++)
74  if (es.get_system(i).has_variable(var_name))
75  return &es.get_system(i);
76 
77  ::mooseError("Unable to find variable " + var_name + " in any system.");
78 
79  // Unreachable
80  return &es.get_system(0);
81 }
A class for creating restricted objects.
Definition: Restartable.h:31
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< SetupInterface >()
Base class for a system (of equations)
Definition: SystemBase.h:91
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
InputParameters validParams< Transfer >()
Definition: Transfer.C:31
Transfer(const InputParameters &parameters)
Definition: Transfer.C:53
static const Number OutOfMeshValue
Definition: Transfer.h:81
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:22
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
static System * find_sys(EquationSystems &es, const std::string &var_name)
Small helper function for finding the system containing the variable.
Definition: Transfer.C:70
unsigned int THREAD_ID
Definition: MooseTypes.h:79