www.mooseframework.org
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
AddPeriodicBCAction Class Reference

This Action adds a periodic boundary to the problem. More...

#include <AddPeriodicBCAction.h>

Inheritance diagram for AddPeriodicBCAction:
[legend]

Public Member Functions

 AddPeriodicBCAction (InputParameters params)
 
virtual void act () override
 Method to add objects to the simulation or perform other setup tasks. More...
 
void timedAct ()
 The method called externally that causes the action to act() More...
 
virtual void addRelationshipManagers (Moose::RelationshipManagerType when_type)
 Method to add a relationship manager for the objects being added to the system. More...
 
const std::string & name () const
 The name of the action. More...
 
const std::string & type () const
 
InputParametersparameters ()
 
const InputParametersparameters () const
 
const std::string & specificTaskName () const
 
const std::set< std::string > & getAllTasks () const
 
template<typename T >
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 Verifies that the requested parameter exists and is not NULL and returns it to the caller. More...
 
bool isParamValid (const std::string &name) const
 
void appendTask (const std::string &task)
 
template<typename... Args>
void paramError (const std::string &param, Args... args)
 Emits an error prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message. More...
 
template<typename... Args>
void paramWarning (const std::string &param, Args... args)
 Emits a warning prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message. More...
 
template<typename... Args>
void paramInfo (const std::string &param, Args... args)
 Emits an informational message prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message. More...
 
std::string getBaseName () const
 Deprecated name methods, use name() More...
 
std::string getShortName () const
 DEPRECATED METHODS. More...
 
template<typename T >
const T & getParam (const std::string &name) const
 Retrieve a parameter for the object. More...
 

Public Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Protected Member Functions

bool autoTranslationBoundaries ()
 This function will automatically add the correct translation vectors for each requested dimension when using GeneratedMesh. More...
 
void setPeriodicVars (PeriodicBoundaryBase &p, const std::vector< VariableName > &var_names)
 
void addRelationshipManagers (Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
 Method to add a relationship manager for the objects being added to the system. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level)
 Call to register a named section for timing. More...
 

Protected Attributes

MooseMesh_mesh
 
InputParameters _pars
 Input parameters for the action. More...
 
std::string _registered_identifier
 
std::string _name
 The name of the action. More...
 
std::string _action_type
 
MooseApp_app
 The MOOSE application this is associated with. More...
 
Factory_factory
 The Factory associated with the MooseApp. More...
 
ActionFactory_action_factory
 Builds Actions. More...
 
std::string _specific_task_name
 This member will only be populated if this Action instance is only designed to handle one task. More...
 
std::set< std::string > _all_tasks
 A list of all the tasks that this Action will satisfy. More...
 
ActionWarehouse_awh
 Reference to ActionWarehouse where we store object build by actions. More...
 
const std::string & _current_task
 The current action (even though we have seperate instances for each action) More...
 
std::shared_ptr< MooseMesh > & _displaced_mesh
 
std::shared_ptr< FEProblemBase > & _problem
 Convenience reference to a problem this action works on. More...
 
PerfID _act_timer
 Timers. More...
 
const InputParameters_pg_params
 Params. More...
 
PerfGraph_perf_graph
 The performance graph to add to. More...
 
std::string _prefix
 A prefix to use for all sections. More...
 

Detailed Description

This Action adds a periodic boundary to the problem.

Note that Periodic Boundaries are not MooseObjects so you need not specify a type for these boundaries. If you do, it will currently be ignored by this Action.

Definition at line 30 of file AddPeriodicBCAction.h.

Constructor & Destructor Documentation

◆ AddPeriodicBCAction()

AddPeriodicBCAction::AddPeriodicBCAction ( InputParameters  params)

Definition at line 53 of file AddPeriodicBCAction.C.

53 : Action(params) {}
Action(InputParameters parameters)
Definition: Action.C:50

Member Function Documentation

◆ act()

void AddPeriodicBCAction::act ( )
overridevirtual

Method to add objects to the simulation or perform other setup tasks.

Implements Action.

Definition at line 152 of file AddPeriodicBCAction.C.

153 {
154  if (_current_task == "add_geometric_rm")
155  {
156  auto rm_params = _factory.getValidParams("ElementSideNeighborLayers");
157 
158  rm_params.set<std::string>("for_whom") = "PeriodicBCs";
159  rm_params.set<MooseMesh *>("mesh") = Action::_mesh.get();
160  rm_params.set<Moose::RelationshipManagerType>("rm_type") =
162 
163  // We can't attach this relationship manager early because
164  // the PeriodicBoundaries object needs to exist!
165  rm_params.set<bool>("attach_geometric_early") = false;
166 
167  if (rm_params.areAllRequiredParamsValid())
168  {
169  auto rm_obj = _factory.create<RelationshipManager>(
170  "ElementSideNeighborLayers", "periodic_bc_ghosting_" + name(), rm_params);
171 
172  if (!_app.addRelationshipManager(rm_obj))
174  }
175  else
176  mooseError("Invalid initialization of ElementSideNeighborLayers");
177  }
178 
179  if (_current_task == "add_periodic_bc")
180  {
181  NonlinearSystemBase & nl = _problem->getNonlinearSystemBase();
182  _mesh = &_problem->mesh();
183  auto displaced_problem = _problem->getDisplacedProblem();
184 
186  return;
187 
188  if (_pars.isParamValid("translation"))
189  {
190  RealVectorValue translation = getParam<RealVectorValue>("translation");
191 
192  PeriodicBoundary p(translation);
193  p.myboundary = _mesh->getBoundaryID(getParam<BoundaryName>("primary"));
194  p.pairedboundary = _mesh->getBoundaryID(getParam<BoundaryName>("secondary"));
195  setPeriodicVars(p, getParam<std::vector<VariableName>>("variable"));
196 
197  _problem->addGhostedBoundary(p.myboundary);
198  _problem->addGhostedBoundary(p.pairedboundary);
199 
200  nl.dofMap().add_periodic_boundary(p);
201  if (displaced_problem)
202  displaced_problem->nlSys().dofMap().add_periodic_boundary(p);
203  }
204  else if (getParam<std::vector<std::string>>("transform_func") != std::vector<std::string>())
205  {
206  std::vector<std::string> inv_fn_names =
207  getParam<std::vector<std::string>>("inv_transform_func");
208  std::vector<std::string> fn_names = getParam<std::vector<std::string>>("transform_func");
209 
210  // If the user provided a forward transformation, he must also provide an inverse -- we can't
211  // form the inverse of an arbitrary function automatically...
212  if (inv_fn_names == std::vector<std::string>())
213  mooseError("You must provide an inv_transform_func for FunctionPeriodicBoundary!");
214 
215  FunctionPeriodicBoundary pb(*_problem, fn_names);
216  pb.myboundary = _mesh->getBoundaryID(getParam<BoundaryName>("primary"));
217  pb.pairedboundary = _mesh->getBoundaryID(getParam<BoundaryName>("secondary"));
218  setPeriodicVars(pb, getParam<std::vector<VariableName>>("variable"));
219 
220  FunctionPeriodicBoundary ipb(*_problem, inv_fn_names);
221  ipb.myboundary =
222  _mesh->getBoundaryID(getParam<BoundaryName>("secondary")); // these are swapped
223  ipb.pairedboundary =
224  _mesh->getBoundaryID(getParam<BoundaryName>("primary")); // these are swapped
225  setPeriodicVars(ipb, getParam<std::vector<VariableName>>("variable"));
226 
227  _problem->addGhostedBoundary(ipb.myboundary);
228  _problem->addGhostedBoundary(ipb.pairedboundary);
229 
230  // Add the pair of periodic boundaries to the dof map
231  nl.dofMap().add_periodic_boundary(pb, ipb);
232  if (displaced_problem)
233  displaced_problem->nlSys().dofMap().add_periodic_boundary(pb, ipb);
234  }
235  else
236  {
237  mooseError(
238  "You have to specify either 'auto_direction', 'translation' or 'trans_func' in your "
239  "period boundary section '" +
240  _name + "'");
241  }
242  }
243 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:87
void setPeriodicVars(PeriodicBoundaryBase &p, const std::vector< VariableName > &var_names)
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:698
const std::string & name() const
The name of the action.
Definition: Action.h:77
VectorValue< Real > RealVectorValue
Definition: Assembly.h:32
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
InputParameters getValidParams(const std::string &name)
Get valid parameters for the object.
Definition: Factory.C:67
Periodic boundary for calculation periodic BC on domains where the translation is given by functions...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: Action.h:225
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:187
bool autoTranslationBoundaries()
This function will automatically add the correct translation vectors for each requested dimension whe...
std::string _name
The name of the action.
Definition: Action.h:178
NonlinearSystemBase * nl
Nonlinear system to be solved.
virtual DofMap & dofMap()
Gets the dof map.
Definition: SystemBase.C:900
bool addRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Transfers ownership of a RelationshipManager to the application for lifetime management.
Definition: MooseApp.C:1677
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:75
const std::string & _current_task
The current action (even though we have seperate instances for each action)
Definition: Action.h:211
void releaseSharedObjects(const MooseObject &moose_object, THREAD_ID tid=0)
Releases any shared resources created as a side effect of creating an object through the Factory::cre...
Definition: Factory.C:166
std::shared_ptr< MooseMesh > & _mesh
Definition: Action.h:213
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:217
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:184
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition: MooseMesh.C:1009
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ addRelationshipManagers() [1/2]

void Action::addRelationshipManagers ( Moose::RelationshipManagerType  when_type,
const InputParameters moose_object_pars 
)
protectedinherited

Method to add a relationship manager for the objects being added to the system.

Relationship managers have to be added relatively early. In many cases before the Action::act() method is called.

Parameters
when_typeThe parameter indicating the normal time for adding either Geometric or Algebraic RelationshipManagers. It may not always be possible to add your RelationshipManager as early as you'd like. In these cases, your DistributedMesh may consume more memory during the problem setup.
moose_object_parsThe MooseObject to inspect for RelationshipManagers to add

Definition at line 95 of file Action.C.

97 {
98  const auto & buildable_types = moose_object_pars.getBuildableRelationshipManagerTypes();
99 
100  // These need unique names
101  static unsigned int unique_object_id = 0;
102 
103  for (const auto & buildable_type : buildable_types)
104  {
105  unique_object_id++;
106 
107  auto & rm_name = std::get<0>(buildable_type);
108  auto & rm_type = std::get<1>(buildable_type);
109  auto rm_input_parameter_func = std::get<2>(buildable_type);
110 
111  auto new_name = moose_object_pars.get<std::string>("_moose_base") + '_' + name() + '_' +
112  rm_name + "_" + Moose::stringify(rm_type) + " " +
113  std::to_string(unique_object_id);
114 
115  auto rm_params = _factory.getValidParams(rm_name);
116  rm_params.set<Moose::RelationshipManagerType>("rm_type") = rm_type;
117  rm_params.set<std::string>("for_whom") = name();
118 
119  // Figure out if we shouldn't be adding this one yet
120  if (((rm_type & input_rm_type) != input_rm_type) // Does this RM not have the type passed in?
121 
122  || // Or are we adding Geometric but this one needs to be delayed
123 
124  (((input_rm_type & Moose::RelationshipManagerType::GEOMETRIC) ==
128  !rm_params.template get<bool>("attach_geometric_early"))
129 
130  || // Or is this an Algebraic and Geometric one that we already added earlier?
131 
132  (((input_rm_type & Moose::RelationshipManagerType::ALGEBRAIC) ==
136  rm_params.template get<bool>("attach_geometric_early")))
137  continue;
138 
139  // If there is a callback for setting the RM parameters let's use it
140  if (rm_input_parameter_func)
141  rm_input_parameter_func(moose_object_pars, rm_params);
142 
143  // If we're doing geometric but we can't build it early - then let's not build it yet
144  // (It will get built when we do algebraic)
145  if ((input_rm_type & Moose::RelationshipManagerType::GEOMETRIC) ==
147  !rm_params.get<bool>("attach_geometric_early"))
148  {
149  // We also need to tell the mesh not to delete remote elements yet
150  // Note this will get reset in AddRelationshipManager::act() when attaching Algebraic
151  _mesh->getMesh().allow_remote_element_removal(false);
152 
153  if (_problem->getDisplacedProblem())
154  _problem->getDisplacedProblem()->mesh().getMesh().allow_remote_element_removal(false);
155 
156  // Keep looking for more RMs
157  continue;
158  }
159  // Ok the above block may have told the mesh not to allow remote element removal during the
160  // initial MeshBase::prepare_for_use, which is called after attaching geometric ghosting
161  // functors. If we did tell the mesh not to allow remote element removal **and** we're using a
162  // DistributedMesh, then we need to tell the mesh to allow remote element removal and ensure
163  // that the mesh will delete its remote elements after the EquationSystems init
164  else if (input_rm_type == Moose::RelationshipManagerType::ALGEBRAIC &&
165  (rm_params.get<Moose::RelationshipManagerType>("rm_type") &
168  !rm_params.get<bool>("attach_geometric_early") && _mesh->isDistributedMesh())
169  {
170  _mesh->needsRemoteElemDeletion(true);
171  if (_displaced_mesh)
172  _displaced_mesh->needsRemoteElemDeletion(true);
173  }
174 
175  rm_params.set<MooseMesh *>("mesh") = _mesh.get();
176 
177  if (rm_params.areAllRequiredParamsValid())
178  {
179  auto rm_obj = _factory.create<RelationshipManager>(rm_name, new_name, rm_params);
180 
181  // Delete the resources created on behalf of the RM if it ends up not being added to the App.
182  if (!_app.addRelationshipManager(rm_obj))
184  }
185  else
186  mooseError("Missing required parameters for RelationshipManager " + rm_name + " for object " +
187  name());
188  }
189 }
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, InputParameters parameters, THREAD_ID tid=0, bool print_deprecated=true)
Build an object (must be registered) - THIS METHOD IS DEPRECATED (Use create<T>()) ...
Definition: Factory.C:87
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:698
const std::string & name() const
The name of the action.
Definition: Action.h:77
const std::vector< std::tuple< std::string, Moose::RelationshipManagerType, Moose::RelationshipManagerInputParameterCallback > > & getBuildableRelationshipManagerTypes() const
Returns the list of buildable (or required) RelationshipManager object types for this object...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
InputParameters getValidParams(const std::string &name)
Get valid parameters for the object.
Definition: Factory.C:67
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Factory & _factory
The Factory associated with the MooseApp.
Definition: Action.h:187
bool addRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Transfers ownership of a RelationshipManager to the application for lifetime management.
Definition: MooseApp.C:1677
std::shared_ptr< MooseMesh > & _displaced_mesh
Definition: Action.h:214
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:75
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:61
void releaseSharedObjects(const MooseObject &moose_object, THREAD_ID tid=0)
Releases any shared resources created as a side effect of creating an object through the Factory::cre...
Definition: Factory.C:166
std::shared_ptr< MooseMesh > & _mesh
Definition: Action.h:213
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:217
MooseApp & _app
The MOOSE application this is associated with.
Definition: Action.h:184

◆ addRelationshipManagers() [2/2]

void Action::addRelationshipManagers ( Moose::RelationshipManagerType  when_type)
virtualinherited

Method to add a relationship manager for the objects being added to the system.

Relationship managers have to be added relatively early. In many cases before the Action::act() method is called.

Parameters
when_typeThe parameter indicating the normal time for adding either Geometric or Algebraic RelationshipManagers. It may not always be possible to add your RelationshipManager as early as you'd like. In these cases, your DistributedMesh may consume more memory during the problem setup.

Reimplemented in MooseObjectAction.

Definition at line 92 of file Action.C.

92 {}

◆ appendTask()

void Action::appendTask ( const std::string &  task)
inlineinherited

Definition at line 118 of file Action.h.

118 { _all_tasks.insert(task); }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:205

◆ autoTranslationBoundaries()

bool AddPeriodicBCAction::autoTranslationBoundaries ( )
protected

This function will automatically add the correct translation vectors for each requested dimension when using GeneratedMesh.

Returns
a boolean indicating whether or not these boundaries were automatically added

Definition at line 80 of file AddPeriodicBCAction.C.

Referenced by act().

81 {
82  auto displaced_problem = _problem->getDisplacedProblem();
83 
84  if (isParamValid("auto_direction"))
85  {
86  // If we are working with a parallel mesh then we're going to ghost all the boundaries
87  // everywhere because we don't know what we need...
88  if (_mesh->isDistributedMesh())
89  {
90  const std::set<BoundaryID> & ids = _mesh->meshBoundaryIds();
91  for (const auto & bid : ids)
92  _problem->addGhostedBoundary(bid);
93 
94  _problem->ghostGhostedBoundaries();
95 
96  bool is_orthogonal_mesh = _mesh->detectOrthogonalDimRanges();
97 
98  // If we can't detect the orthogonal dimension ranges for this
99  // Mesh, then auto_direction periodicity isn't going to work.
100  if (!is_orthogonal_mesh)
101  mooseError("Could not detect orthogonal dimension ranges for DistributedMesh.");
102  }
103 
104  NonlinearSystemBase & nl = _problem->getNonlinearSystemBase();
105  std::vector<std::string> auto_dirs = getParam<std::vector<std::string>>("auto_direction");
106 
107  int dim_offset = _mesh->dimension() - 2;
108  for (const auto & dir : auto_dirs)
109  {
110  int component = -1;
111  if (dir == "X" || dir == "x")
112  component = 0;
113  else if (dir == "Y" || dir == "y")
114  {
115  if (dim_offset < 0)
116  mooseError("Cannot wrap 'Y' direction when using a 1D mesh");
117  component = 1;
118  }
119  else if (dir == "Z" || dir == "z")
120  {
121  if (dim_offset <= 0)
122  mooseError("Cannot wrap 'Z' direction when using a 1D or 2D mesh");
123  component = 2;
124  }
125 
126  if (component >= 0)
127  {
128  const std::pair<BoundaryID, BoundaryID> * boundary_ids =
129  _mesh->getPairedBoundaryMapping(component);
130  RealVectorValue v;
131  v(component) = _mesh->dimensionWidth(component);
132  PeriodicBoundary p(v);
133 
134  if (boundary_ids == NULL)
135  mooseError(
136  "Couldn't auto-detect a paired boundary for use with periodic boundary conditions");
137 
138  p.myboundary = boundary_ids->first;
139  p.pairedboundary = boundary_ids->second;
140  setPeriodicVars(p, getParam<std::vector<VariableName>>("variable"));
141  nl.dofMap().add_periodic_boundary(p);
142  if (displaced_problem)
143  displaced_problem->nlSys().dofMap().add_periodic_boundary(p);
144  }
145  }
146  return true;
147  }
148  return false;
149 }
bool isParamValid(const std::string &name) const
Definition: Action.h:116
void setPeriodicVars(PeriodicBoundaryBase &p, const std::vector< VariableName > &var_names)
VectorValue< Real > RealVectorValue
Definition: Assembly.h:32
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
bool isDistributedMesh() const
Returns the final Mesh distribution type.
Definition: MooseMesh.h:785
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition: Action.h:225
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh...
Definition: MooseMesh.C:2324
NonlinearSystemBase * nl
Nonlinear system to be solved.
virtual DofMap & dofMap()
Gets the dof map.
Definition: SystemBase.C:900
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimsension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh m...
Definition: MooseMesh.C:2135
const std::pair< BoundaryID, BoundaryID > * getPairedBoundaryMapping(unsigned int component)
This function attempts to return the paired boundary ids for the given component. ...
Definition: MooseMesh.C:1549
bool detectOrthogonalDimRanges(Real tol=1e-6)
This routine determines whether the Mesh is a regular orthogonal mesh (i.e.
Definition: MooseMesh.C:1285
Real dimensionWidth(unsigned int component) const
Returns the width of the requested dimension.
Definition: MooseMesh.C:1462
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:217

◆ getAllTasks()

const std::set<std::string>& Action::getAllTasks ( ) const
inlineinherited

Definition at line 94 of file Action.h.

Referenced by AddKernelAction::act().

94 { return _all_tasks; }
std::set< std::string > _all_tasks
A list of all the tasks that this Action will satisfy.
Definition: Action.h:205

◆ getBaseName()

std::string Action::getBaseName ( ) const
inherited

Deprecated name methods, use name()

Definition at line 200 of file Action.C.

201 {
202  mooseDeprecated("getBaseName() is deprecated.");
203  return MooseUtils::baseName(_name);
204 }
std::string _name
The name of the action.
Definition: Action.h:178
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:237
std::string baseName(const std::string &name)
Function for string the information before the final / in a parser block.
Definition: MooseUtils.C:369

◆ getCheckedPointerParam()

template<typename T >
T Action::getCheckedPointerParam ( const std::string &  name,
const std::string &  error_string = "" 
) const
inlineinherited

Verifies that the requested parameter exists and is not NULL and returns it to the caller.

The template parameter must be a pointer or an error will be thrown.

Definition at line 111 of file Action.h.

112  {
113  return parameters().getCheckedPointerParam<T>(name, error_string);
114  }
const std::string & name() const
The name of the action.
Definition: Action.h:77
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
InputParameters & parameters()
Definition: Action.h:89

◆ getParam()

template<typename T >
const T & Action::getParam ( const std::string &  name) const
inherited

Retrieve a parameter for the object.

Parameters
nameThe name of the parameter
Returns
The value of the parameter

Definition at line 225 of file Action.h.

Referenced by CreateDisplacedProblemAction::act(), act(), autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), and MooseApp::getCheckpointDirectories().

226 {
227  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
228 }
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type)
const std::string & name() const
The name of the action.
Definition: Action.h:77
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172

◆ getShortName()

std::string Action::getShortName ( ) const
inherited

DEPRECATED METHODS.

Definition at line 193 of file Action.C.

194 {
195  mooseDeprecated("getShortName() is deprecated.");
197 }
std::string shortName(const std::string &name)
Function for stripping name after the file / in parser block.
Definition: MooseUtils.C:363
std::string _name
The name of the action.
Definition: Action.h:178
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:237

◆ isParamValid()

bool Action::isParamValid ( const std::string &  name) const
inlineinherited

Definition at line 116 of file Action.h.

Referenced by CopyNodalVarsAction::act(), SetAdaptivityOptionsAction::act(), SetupMeshAction::act(), CreateDisplacedProblemAction::act(), AddAuxVariableAction::act(), AddVariableAction::act(), AddVariableAction::addVariable(), autoTranslationBoundaries(), DynamicObjectRegistrationAction::DynamicObjectRegistrationAction(), and SetupMeshAction::setupMesh().

116 { return _pars.isParamValid(name); }
const std::string & name() const
The name of the action.
Definition: Action.h:77
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.

◆ name()

const std::string& Action::name ( ) const
inlineinherited

◆ paramError()

template<typename... Args>
void Action::paramError ( const std::string &  param,
Args...  args 
)
inlineinherited

Emits an error prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message.

If this object's parameters were not created directly by the Parser, then this function falls back to the normal behavior of mooseError - only printing a message using the given args.

Definition at line 127 of file Action.h.

127  {
128  auto prefix = param + ": ";
129  if (!_pars.inputLocation(param).empty())
130  prefix = _pars.inputLocation(param) + ": (" + _pars.paramFullpath(param) + "):\n";
131  mooseError(prefix, args...);
132  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172
const std::string & inputLocation(const std::string &param) const
Get/set a string representing the location in the input text the parameter originated from (i...
const std::string & paramFullpath(const std::string &param) const
Get/set a string representing the full HIT parameter path from the input file (e.g.

◆ parameters() [1/2]

InputParameters& Action::parameters ( )
inlineinherited

Definition at line 89 of file Action.h.

Referenced by Action::getCheckedPointerParam(), GlobalParamsAction::remove(), GlobalParamsAction::setDoubleIndexParam(), GlobalParamsAction::setScalarParam(), and GlobalParamsAction::setVectorParam().

89 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172

◆ parameters() [2/2]

const InputParameters& Action::parameters ( ) const
inlineinherited

Definition at line 90 of file Action.h.

90 { return _pars; }
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172

◆ paramInfo()

template<typename... Args>
void Action::paramInfo ( const std::string &  param,
Args...  args 
)
inlineinherited

Emits an informational message prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message.

If this object's parameters were not created directly by the Parser, then this function falls back to the normal behavior of mooseInfo - only printing a message using the given args.

Definition at line 157 of file Action.h.

158  {
159  auto prefix = param + ": ";
160  if (!_pars.inputLocation(param).empty())
161  prefix = _pars.inputLocation(param) + ": (" + _pars.paramFullpath(param) + "):\n";
162  mooseInfo(prefix, args...);
163  }
void mooseInfo(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition: MooseError.h:253
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172
const std::string & inputLocation(const std::string &param) const
Get/set a string representing the location in the input text the parameter originated from (i...
const std::string & paramFullpath(const std::string &param) const
Get/set a string representing the full HIT parameter path from the input file (e.g.

◆ paramWarning()

template<typename... Args>
void Action::paramWarning ( const std::string &  param,
Args...  args 
)
inlineinherited

Emits a warning prefixed with the file and line number of the given param (from the input file) along with the full parameter path+name followed by the given args as the message.

If this object's parameters were not created directly by the Parser, then this function falls back to the normal behavior of mooseWarning - only printing a message using the given args.

Definition at line 141 of file Action.h.

142  {
143  auto prefix = param + ": ";
144  if (!_pars.inputLocation(param).empty())
145  prefix = _pars.inputLocation(param) + ": (" + _pars.paramFullpath(param) + "):\n";
146  mooseWarning(prefix, args...);
147  }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:220
InputParameters _pars
Input parameters for the action.
Definition: Action.h:172
const std::string & inputLocation(const std::string &param) const
Get/set a string representing the location in the input text the parameter originated from (i...
const std::string & paramFullpath(const std::string &param) const
Get/set a string representing the full HIT parameter path from the input file (e.g.

◆ registerTimedSection()

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level 
)
protectedinherited

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
Returns
The ID of the section - use when starting timing

Definition at line 50 of file PerfGraphInterface.C.

51 {
52  if (_prefix != "")
53  return _perf_graph.registerSection(_prefix + "::" + section_name, level);
54  else
55  return _perf_graph.registerSection(section_name, level);
56 }
PerfGraph & _perf_graph
The performance graph to add to.
std::string _prefix
A prefix to use for all sections.
PerfID registerSection(const std::string &section_name, unsigned int level)
Registers a named section of code.
Definition: PerfGraph.C:42

◆ setPeriodicVars()

void AddPeriodicBCAction::setPeriodicVars ( PeriodicBoundaryBase &  p,
const std::vector< VariableName > &  var_names 
)
protected

Definition at line 56 of file AddPeriodicBCAction.C.

Referenced by act(), and autoTranslationBoundaries().

58 {
59  NonlinearSystemBase & nl = _problem->getNonlinearSystemBase();
60  const std::vector<VariableName> * var_names_ptr;
61 
62  // If var_names is empty - then apply this periodic condition to all variables in the system
63  if (var_names.empty())
64  var_names_ptr = &nl.getVariableNames();
65  else
66  var_names_ptr = &var_names;
67 
68  for (const auto & var_name : *var_names_ptr)
69  {
70  if (!nl.hasScalarVariable(var_name))
71  {
72  unsigned int var_num = nl.getVariable(0, var_name).number();
73  p.set_variable(var_num);
74  _mesh->addPeriodicVariable(var_num, p.myboundary, p.pairedboundary);
75  }
76  }
77 }
unsigned int number() const
Get variable number coming from libMesh.
NonlinearSystemBase * nl
Nonlinear system to be solved.
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:105
void addPeriodicVariable(unsigned int var_num, BoundaryID primary, BoundaryID secondary)
For "regular orthogonal" meshes, determine if variable var_num is periodic with respect to the primar...
Definition: MooseMesh.C:1486
const std::vector< VariableName > & getVariableNames() const
Definition: SystemBase.h:670
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
Definition: Action.h:217
virtual bool hasScalarVariable(const std::string &var_name) const
Definition: SystemBase.C:661

◆ specificTaskName()

const std::string& Action::specificTaskName ( ) const
inlineinherited

Definition at line 92 of file Action.h.

92 { return _specific_task_name; }
std::string _specific_task_name
This member will only be populated if this Action instance is only designed to handle one task...
Definition: Action.h:198

◆ timedAct()

void Action::timedAct ( )
inherited

The method called externally that causes the action to act()

Definition at line 86 of file Action.C.

87 {
88  TIME_SECTION(_act_timer);
89  act();
90 }
PerfID _act_timer
Timers.
Definition: Action.h:220
virtual void act()=0
Method to add objects to the simulation or perform other setup tasks.

◆ type()

const std::string& Action::type ( ) const
inlineinherited

Member Data Documentation

◆ _act_timer

PerfID Action::_act_timer
protectedinherited

Timers.

Definition at line 220 of file Action.h.

Referenced by Action::timedAct().

◆ _action_factory

ActionFactory& Action::_action_factory
protectedinherited

◆ _action_type

std::string Action::_action_type
protectedinherited

Definition at line 181 of file Action.h.

Referenced by Action::type().

◆ _all_tasks

std::set<std::string> Action::_all_tasks
protectedinherited

A list of all the tasks that this Action will satisfy.

Note: That this is not populated at construction time. However, all tasks will be added prior to act().

Definition at line 205 of file Action.h.

Referenced by Action::appendTask(), and Action::getAllTasks().

◆ _app

MooseApp& Action::_app
protectedinherited

◆ _awh

ActionWarehouse& Action::_awh
protectedinherited

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 32 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), SetupRecoverFileBaseAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), SimplePredictor::apply(), MultiApp::backup(), FEProblemBase::backupMultiApps(), FEProblemBase::checkProblemIntegrity(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeResidualTags(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppVectorPostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppCopyTransfer::execute(), Steady::execute(), MultiAppDTKUserObjectTransfer::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), FEProblemBase::FEProblemBase(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MultiApp::globalAppToLocal(), InversePowerMethod::init(), NonlinearEigen::init(), Steady::init(), FEProblemBase::initialAdaptMesh(), FEProblemBase::initialSetup(), EigenExecutionerBase::inversePowerIteration(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseObject::mooseDeprecated(), MooseObject::mooseInfo(), MooseObject::mooseWarning(), PerfGraphOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), EigenExecutionerBase::printEigenvalue(), MaterialPropertyDebugOutput::printMaterialMap(), SolutionTimeAdaptiveDT::rejectStep(), DT2::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), NonlinearSystem::solve(), PicardSolve::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), PicardSolve::solveStep(), DT2::step(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _current_task

const std::string& Action::_current_task
protectedinherited

◆ _displaced_mesh

std::shared_ptr<MooseMesh>& Action::_displaced_mesh
protectedinherited

◆ _factory

Factory& Action::_factory
protectedinherited

◆ _mesh

MooseMesh* AddPeriodicBCAction::_mesh
protected

Definition at line 47 of file AddPeriodicBCAction.h.

Referenced by act(), autoTranslationBoundaries(), and setPeriodicVars().

◆ _name

std::string Action::_name
protectedinherited

◆ _pars

InputParameters Action::_pars
protectedinherited

◆ _perf_graph

PerfGraph& PerfGraphInterface::_perf_graph
protectedinherited

The performance graph to add to.

Definition at line 66 of file PerfGraphInterface.h.

Referenced by PerfGraphData::getValue(), and PerfGraphInterface::registerTimedSection().

◆ _pg_params

const InputParameters* PerfGraphInterface::_pg_params
protectedinherited

Params.

Definition at line 63 of file PerfGraphInterface.h.

◆ _prefix

std::string PerfGraphInterface::_prefix
protectedinherited

A prefix to use for all sections.

Definition at line 69 of file PerfGraphInterface.h.

Referenced by PerfGraphInterface::registerTimedSection().

◆ _problem

std::shared_ptr<FEProblemBase>& Action::_problem
protectedinherited

Convenience reference to a problem this action works on.

Definition at line 217 of file Action.h.

Referenced by AddBCAction::act(), AddBoundsVectorsAction::act(), CopyNodalVarsAction::act(), AddDamperAction::act(), AddKernelAction::act(), AddMarkerAction::act(), AddNodalKernelAction::act(), AddICAction::act(), AddPostprocessorAction::act(), AddScalarKernelAction::act(), AddInitialConditionAction::act(), AddConstraintAction::act(), CreateExecutionerAction::act(), AddVectorPostprocessorAction::act(), AddIndicatorAction::act(), AddElementalFieldAction::act(), AddTransferAction::act(), AddUserObjectAction::act(), AddDiracKernelAction::act(), CheckIntegrityAction::act(), AddInterfaceKernelAction::act(), AddDGKernelAction::act(), SetupDampersAction::act(), AddMultiAppAction::act(), AddMaterialAction::act(), InitProblemAction::act(), SetAdaptivityOptionsAction::act(), CreateProblemAction::act(), CreateProblemDefaultAction::act(), AddFieldSplitAction::act(), AdaptivityAction::act(), SetupDebugAction::act(), AddDistributionAction::act(), SetupPreconditionerAction::act(), SetupPredictorAction::act(), SetupTimeIntegratorAction::act(), SetupTimeStepperAction::act(), AddFunctionAction::act(), CreateDisplacedProblemAction::act(), SetupResidualDebugAction::act(), MaterialDerivativeTestAction::act(), SetupQuadratureAction::act(), DisplayGhostingAction::act(), AddSamplerAction::act(), AddExternalAuxVariableAction::act(), AddOutputAction::act(), AddAuxVariableAction::act(), act(), MaterialOutputAction::act(), AddControlAction::act(), SetupPostprocessorDataAction::act(), AddNodalNormalsAction::act(), Action::addRelationshipManagers(), AddVariableAction::addVariable(), autoTranslationBoundaries(), CheckOutputAction::checkMaterialOutput(), AddVariableAction::getSubdomainIDs(), and setPeriodicVars().

◆ _registered_identifier

std::string Action::_registered_identifier
protectedinherited

Definition at line 175 of file Action.h.

◆ _specific_task_name

std::string Action::_specific_task_name
protectedinherited

This member will only be populated if this Action instance is only designed to handle one task.

This happens when an Action is registered with several pieces of syntax in which case separate instances are built to handle the different incoming parameter values.

Definition at line 198 of file Action.h.

Referenced by Action::specificTaskName().


The documentation for this class was generated from the following files: