https://mooseframework.inl.gov
Loading...
Searching...
No Matches
InitialConditionBase.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
11#include "SystemBase.h"
12#include "MooseVariableFE.h"
13#include "UserObject.h"
14
17{
23
24 params.addRequiredParam<VariableName>("variable",
25 "The variable this initial condition is "
26 "supposed to provide values for.");
27 params.addParam<bool>("ignore_uo_dependency",
28 false,
29 "When set to true, a UserObject retrieved "
30 "by this IC will not be executed before the "
31 "this IC");
32
33 params.addParamNamesToGroup("ignore_uo_dependency", "Advanced");
34
35 params.registerBase("InitialCondition");
36
37 return params;
38}
39
41 : MooseObject(parameters),
42 InitialConditionInterface(parameters),
44 Coupleable(this,
45 getParam<SystemBase *>("_sys")
46 ->getVariable(parameters.get<THREAD_ID>("_tid"),
47 parameters.get<VariableName>("variable"))
48 .isNodal()),
49 MaterialPropertyInterface(this, blockIDs(), Moose::EMPTY_BOUNDARY_IDS),
53 BoundaryRestrictable(this, _c_nodal),
55 Restartable(this, "InitialConditionBases"),
57 _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
58 _ignore_uo_dependency(getParam<bool>("ignore_uo_dependency"))
59{
60 _supplied_vars.insert(getParam<VariableName>("variable"));
61
62 const auto & coupled_vars = getCoupledVars();
63 for (const auto & it : coupled_vars)
64 for (const auto & var : it.second)
65 _depend_vars.insert(var->name());
66}
67
69
70const std::set<std::string> &
75
76const std::set<std::string> &
81
82void
88
89void
90InitialConditionBase::addPostprocessorDependencyHelper(const PostprocessorName & name) const
91{
93 _depend_uo.insert(name);
94}
unsigned int THREAD_ID
Definition MooseTypes.h:237
An interface that restricts an object to subdomains via the 'blocks' input parameter.
static InputParameters validParams()
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
static InputParameters validParams()
Interface for objects that needs coupling capabilities.
Definition Coupleable.h:53
const std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > & getCoupledVars() const
Get the list of coupled variables.
Definition Coupleable.h:75
Interface for sorting dependent vectors of objects.
Interface for objects that need to use functions.
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
InitialConditionBase(const InputParameters &parameters)
Constructor.
void addPostprocessorDependencyHelper(const PostprocessorName &name) const override final
Helper for deriving classes to override to add dependencies when a Postprocessor is requested.
std::set< UserObjectName > _depend_uo
Depend UserObjects. Mutable so that the getters can be const and still add dependencies.
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
void addUserObjectDependencyHelper(const UserObjectBase &uo) const override final
Helper for deriving classes to override to add dependencies when a UserObject is requested.
const bool _ignore_uo_dependency
If set, UOs retrieved by this IC will not be executed before this IC.
std::set< std::string > _depend_vars
Dependent variables.
std::set< std::string > _supplied_vars
Supplied variables.
static InputParameters validParams()
InitialConditionInterface serves as the abstract class for InitialConditions, FVInitialConditions,...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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...
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
An interface for accessing Materials.
static InputParameters validParams()
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
static InputParameters validParams()
Definition MooseObject.C:25
Interface class for classes which interact with Postprocessors.
A class for creating restricted objects.
Definition Restartable.h:29
Base class for a system (of equations)
Definition SystemBase.h:87
Interface for objects that need to use UserObjects.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...