www.mooseframework.org
UserObject.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 "UserObject.h"
16 #include "SubProblem.h"
17 #include "Assembly.h"
18 
19 #include "libmesh/sparse_matrix.h"
20 
21 template <>
24 {
26 
27  // Add the SetupInterface parameter, 'execute_on', and set it to a default of 'timestep_end'
28  params += validParams<SetupInterface>();
29  params.set<MultiMooseEnum>("execute_on") = "timestep_end";
30 
31  params.addParam<bool>("use_displaced_mesh",
32  false,
33  "Whether or not this object should use the "
34  "displaced mesh for computation. Note that "
35  "in the case this is true but no "
36  "displacements are provided in the Mesh block "
37  "the undisplaced mesh will still be used.");
38  params.addParam<bool>("allow_duplicate_execution_on_initial",
39  false,
40  "In the case where this UserObject is depended upon by an initial "
41  "condition, allow it to be executed twice during the initial setup (once "
42  "before the IC and again after mesh adaptivity (if applicable).");
43 
44  params.declareControllable("enable");
45 
46  params.registerBase("UserObject");
47 
48  params.addParamNamesToGroup("use_displaced_mesh allow_duplicate_execution_on_initial",
49  "Advanced");
50  return params;
51 }
52 
54  : MooseObject(parameters),
55  SetupInterface(this),
56  FunctionInterface(this),
58  Restartable(parameters, "UserObjects"),
59  MeshChangedInterface(parameters),
60  ScalarCoupleable(this),
61  _subproblem(*parameters.getCheckedPointerParam<SubProblem *>("_subproblem")),
62  _fe_problem(*parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
63  _tid(parameters.get<THREAD_ID>("_tid")),
64  _assembly(_subproblem.assembly(_tid)),
65  _coord_sys(_assembly.coordSystem()),
66  _duplicate_initial_execution(getParam<bool>("allow_duplicate_execution_on_initial"))
67 {
68 }
69 
71 
72 void
73 UserObject::load(std::ifstream & /*stream*/)
74 {
75 }
76 
77 void
78 UserObject::store(std::ofstream & /*stream*/)
79 {
80 }
virtual void load(std::ifstream &stream)
Load user data object from a stream.
Definition: UserObject.C:73
virtual void store(std::ofstream &stream)
Store user data object to a stream.
Definition: UserObject.C:78
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 >()
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Interface for notifications that the mesh has changed.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
Interface for objects that need to use distributions.
InputParameters validParams< UserObject >()
Definition: UserObject.C:23
virtual ~UserObject()
Definition: UserObject.C:70
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:22
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
UserObject(const InputParameters &params)
Definition: UserObject.C:53
Interface for objects that needs scalar coupling capabilities.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Interface for objects that need to use functions.
unsigned int THREAD_ID
Definition: MooseTypes.h:79