https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
31void
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}
void mooseInfoRepeated(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition MooseError.h:409
Base class for components that are defined using an action.
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...
std::vector< SubdomainName > _blocks
Names of the blocks the component is comprised of.
const bool _verbose
Whether the component setup should be verbose.
static InputParameters validParams()
T * getPhysics(const std::string &name) const
Retrieve a Physics with its name and the desired type.
virtual void addPhysics() override
Used to add one or more Physics to be active on the component.
std::vector< PhysicsBase * > _physics
Pointers to the Physics defined on the component.
static InputParameters validParams()
ComponentPhysicsInterface(const InputParameters &params)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
Definition MooseApp.h:217
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition MooseBase.h:87
Base class to help creating an entire physics.
Definition PhysicsBase.h:31
std::string stringify(const T &t)
conversion to string
Definition Conversion.h:64