https://mooseframework.inl.gov
ComponentPhysicsInterface.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 
14 {
15  auto params = ActionComponent::validParams();
16  params.addParam<std::vector<PhysicsName>>(
17  "physics", {}, "Physics object(s) active on the Component");
18  return params;
19 }
20 
22  : ActionComponent(params), _physics_names(getParam<std::vector<PhysicsName>>("physics"))
23 {
24  // Adding ActionComponents must be done after adding Physics
25  for (const auto & physics_name : getParam<std::vector<PhysicsName>>("physics"))
26  _physics.push_back(getMooseApp().actionWarehouse().getPhysics<PhysicsBase>(physics_name));
27 
28  addRequiredTask("init_component_physics");
29 }
30 
31 void
33 {
34  for (auto physics : _physics)
35  {
36  if (_verbose)
37  mooseInfoRepeated("Adding Physics '" + physics->name() + "' on component '" + name() +
38  "' on blocks '" + Moose::stringify(_blocks) + "'");
39  physics->addComponent(*this);
40  }
41 }
std::vector< PhysicsBase * > _physics
Pointers to the Physics defined on the component.
void mooseInfoRepeated(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition: MooseError.h:377
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Base class for components that are defined using an action.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
static InputParameters validParams()
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition: MooseBase.h:45
static InputParameters validParams()
std::vector< SubdomainName > _blocks
Names of the blocks the component is comprised of.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
const bool _verbose
Whether the component setup should be verbose.
std::string stringify(const T &t)
conversion to string
Definition: Conversion.h:64
virtual void addPhysics() override
Used to add one or more Physics to be active on the component.
void addRequiredTask(const std::string &task)
Add a new required task for all physics deriving from this class NOTE: This does not register the tas...
ComponentPhysicsInterface(const InputParameters &params)