www.mooseframework.org
InitialConditionBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "InitialConditionBase.h"
11 #include "SystemBase.h"
12 #include "MooseVariableFE.h"
13 
14 template <>
17 {
21 
22  params.addRequiredParam<VariableName>("variable",
23  "The variable this initial condition is "
24  "supposed to provide values for.");
25  params.addParam<bool>("ignore_uo_dependency",
26  false,
27  "When set to true, a UserObject retrieved "
28  "by this IC will not be executed before the "
29  "this IC");
30 
31  params.addParamNamesToGroup("ignore_uo_dependency", "Advanced");
32 
33  params.registerBase("InitialCondition");
34 
35  return params;
36 }
37 
39  : MooseObject(parameters),
40  BlockRestrictable(this),
41  Coupleable(this,
42  getParam<SystemBase *>("_sys")
43  ->getVariable(parameters.get<THREAD_ID>("_tid"),
44  parameters.get<VariableName>("variable"))
45  .isNodal()),
46  FunctionInterface(this),
47  UserObjectInterface(this),
48  BoundaryRestrictable(this, _c_nodal),
50  Restartable(this, "InitialConditionBases"),
51  _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
52  _ignore_uo_dependency(getParam<bool>("ignore_uo_dependency"))
53 {
54  _supplied_vars.insert(getParam<VariableName>("variable"));
55 
56  std::map<std::string, std::vector<MooseVariableFEBase *>> coupled_vars = getCoupledVars();
57  for (const auto & it : coupled_vars)
58  for (const auto & var : it.second)
59  _depend_vars.insert(var->name());
60 }
61 
63 
64 const std::set<std::string> &
66 {
67  return _depend_vars;
68 }
69 
70 const std::set<std::string> &
72 {
73  return _supplied_vars;
74 }
75 
76 const UserObject &
77 InitialConditionBase::getUserObjectBase(const std::string & name)
78 {
80  _depend_uo.insert(_pars.get<UserObjectName>(name));
82 }
A class for creating restricted objects.
Definition: Restartable.h:29
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
InputParameters validParams< BlockRestrictable >()
std::set< std::string > _depend_uo
Depend UserObjects.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
Base class for a system (of equations)
Definition: SystemBase.h:92
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
const UserObject & getUserObjectBase(const std::string &name)
reimplements the getUserObjectBase method from UserObjectInterface
const bool _ignore_uo_dependency
If set, UOs retrieved by this IC will not be executed before this IC.
Interface for objects that need to use UserObjects.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:174
InitialConditionBase(const InputParameters &parameters)
Constructor.
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
std::set< std::string > _depend_vars
Dependent variables.
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:62
InputParameters validParams< InitialConditionBase >()
std::set< std::string > _supplied_vars
Supplied variables.
InputParameters validParams< BoundaryRestrictable >()
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
Interface for sorting dependent vectors of objects.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
const UserObject & getUserObjectBase(const std::string &name)
Get an user object with a given parameter name.
Interface for objects that need to use functions.
const std::map< std::string, std::vector< MooseVariableFEBase * > > & getCoupledVars()
Get the list of coupled variables.
Definition: Coupleable.h:81
Base class for user-specific data.
Definition: UserObject.h:37
unsigned int THREAD_ID
Definition: MooseTypes.h:161