22#define registerPhysicsBaseTasks(app_name, derived_name) \
23 registerMooseAction(app_name, derived_name, "init_physics"); \
24 registerMooseAction(app_name, derived_name, "copy_vars_physics"); \
25 registerMooseAction(app_name, derived_name, "check_integrity_early_physics")
46 virtual void act() override final;
57 void addBlocksById(
const std::vector<SubdomainID> & block_ids);
69 const std::vector<SubdomainName> &
blocks,
70 const bool error_if_not_identical =
true)
const;
85 const T *
getCoupledPhysics(
const PhysicsName & phys_name,
const bool allow_fail =
false)
const;
132 mooseAssert(
_problem,
"Requesting the problem too early");
137 mooseAssert(
_problem,
"Requesting the problem too early");
150 bool are_nonlinear =
true);
174 bool variableExists(
const VariableName & var_name,
bool error_if_aux)
const;
180 const SolverSystemName &
getSolverSystem(
unsigned int variable_index)
const;
182 const SolverSystemName &
getSolverSystem(
const VariableName & variable_name)
const;
211 const std::vector<std::pair<MooseEnumItem, std::string>> & petsc_pair_options);
228 const std::vector<SubdomainName> &
blocks,
229 const bool error_if_aux);
245 const std::vector<SubdomainName> &
blocks,
246 const bool ic_is_default_ic,
247 const bool error_if_already_defined)
const;
260 const std::vector<SubdomainName> &
blocks,
261 const bool error_if_already_defined)
const;
275 const std::string & object_type,
276 const std::string & object_name =
"")
const;
370 constexpr bool is_physics = std::is_base_of<PhysicsBase, T>::value;
371 libmesh_ignore(is_physics);
372 mooseAssert(is_physics,
"Must be a PhysicsBase to be retrieved by getCoupledPhysics");
374 for (
const auto *
const physics : all_T_physics)
376 if (physics->name() == phys_name)
382 "' does not exist or is not of type '",
383 MooseUtils::prettyCppType<T>(),
390const std::vector<T *>
393 constexpr bool is_physics = std::is_base_of<PhysicsBase, T>::value;
394 libmesh_ignore(is_physics);
395 mooseAssert(is_physics,
"Must be a PhysicsBase to be retrieved by getCoupledPhysics");
397 if (!allow_fail && all_T_physics.empty())
398 mooseError(
"No Physics of requested type '", MooseUtils::prettyCppType<T>(),
"'");
400 return all_T_physics;
407 if (!
dynamic_cast<const T *
>(&component))
408 mooseError(
"Component '" + component.
name() +
"' must be of type '" +
409 MooseUtils::prettyCppType<T>() +
"'.\nIt is currently of type '" + component.
type() +
Base class for components that are defined using an action.
std::vector< const T * > getActions()
Retrieve all actions in a specific type ordered by their names.
bool addRelationshipManagers(Moose::RelationshipManagerType when_type, const InputParameters &moose_object_pars)
Method to add a relationship manager for the objects being added to the system.
std::shared_ptr< FEProblemBase > & _problem
Convenience reference to a problem this action works on.
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Generic factory class for build all sorts of objects.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Factory & _factory
The Factory associated with the MooseApp.
Base class to help creating an entire physics.
bool solverVariableExists(const VariableName &var_name) const
Check whether a variable already exists and is a solver variable.
const std::vector< VariableName > & auxVariableNames() const
Return the list of aux variables in this physics.
unsigned int _dim
Dimension of the physics, which we expect for now to be the dimension of the mesh NOTE: this is not k...
void checkComponentType(const ActionComponent &component) const
Check that the component is of the desired type.
virtual void addReporters()
virtual void addCorrectors()
void addPetscPairsToPetscOptions(const std::vector< std::pair< MooseEnumItem, std::string > > &petsc_pair_options)
Process the given petsc option pairs into the system solver settings.
static InputParameters validParams()
virtual void checkIntegrity() const
Additional checks performed near the end of the setup phase.
virtual void addFunctions()
virtual void actOnAdditionalTasks()
Routine to add additional setup work on additional registered tasks to a Physics.
virtual void addExecutors()
virtual void addFVInterpolationMethods()
virtual void addMultiApps()
std::set< std::string > _required_tasks
Manually keeps track of the tasks required by each physics as tasks cannot be inherited.
virtual void addExecutioner()
void addBlocksById(const std::vector< SubdomainID > &block_ids)
virtual FEProblemBase & getProblem()
Get the problem for this physics Useful to add objects to the simulation.
void addBlocks(const std::vector< SubdomainName > &blocks)
Add new blocks to the Physics.
std::vector< SolverSystemName > _system_names
System names for the system(s) owning the solver variables.
std::vector< VariableName > _solver_var_names
Vector of the solver variables (nonlinear and linear) in the Physics.
void addUserObject(const std::string &uo_type, const std::string &uo_name, InputParameters ¶ms)
Add a UserObject supplied by this Physics to the problem.
Factory & getFactory()
Get the factory for this physics The factory lets you get the parameters for objects.
std::vector< unsigned int > _system_numbers
System numbers for the system(s) owning the solver variables.
bool shouldCreateIC(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool ic_is_default_ic, const bool error_if_already_defined) const
Returns whether this Physics should create the variable.
bool checkBlockRestrictionIdentical(const std::string &object_name, const std::vector< SubdomainName > &blocks, const bool error_if_not_identical=true) const
Check if an external object has the same block restriction.
virtual void addTransfers()
virtual void addOutputs()
bool allMeshBlocks(const std::vector< SubdomainName > &blocks) const
Check if a vector contains all the mesh blocks.
virtual void addInitialConditions()
bool shouldCreateTimeDerivative(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_already_defined) const
Returns whether this Physics should create the variable.
virtual void addFVInterfaceKernels()
std::set< SubdomainID > getSubdomainIDs(const std::set< SubdomainName > &blocks) const
Get the set of subdomain ids for the incoming vector of subdomain names.
virtual void addAuxiliaryKernels()
virtual void addNodalKernels()
const T * getCoupledPhysics(const PhysicsName &phys_name, const bool allow_fail=false) const
Get a Physics from the ActionWarehouse with the requested type and name.
void initializePhysics()
Process some parameters that require the problem to be created. Executed on init_physics.
void assignBlocks(InputParameters ¶ms, const std::vector< SubdomainName > &blocks) const
Set the blocks parameter to the input parameters of an object this Physics will create.
unsigned int dimension() const
Return the maximum dimension of the blocks the Physics is active on.
virtual void checkIntegrityEarly() const
Additional checks performed once the executioner / executor has been created.
void reportPotentiallyMissedParameters(const std::vector< std::string > ¶m_names, const std::string &object_type, const std::string &object_name="") const
When this is called, we are knowingly not using the value of these parameters.
void saveSolverVariableName(const VariableName &var_name)
Keep track of the name of the solver variable defined in the Physics.
const std::vector< VariableName > & solverVariableNames() const
Return the list of solver (nonlinear + linear) variables in this physics.
virtual void addScalarKernels()
std::string prefix() const
Use prefix() to disambiguate names.
void copyVariablesFromMesh(const std::vector< VariableName > &variables_to_copy, bool are_nonlinear=true)
Copy nonlinear or aux variables from the mesh file.
virtual void addComponent(const ActionComponent &component)
Most basic way of adding a component: simply adding the blocks to the block restriction of the Physic...
void prepareCopyVariablesFromMesh() const
Tell the app if we want to use Exodus restart.
virtual const FEProblemBase & getProblem() const
std::vector< std::string > getSubdomainNamesAndIDs(const std::set< SubdomainID > &blocks) const
Get the vector of subdomain names and ids for the incoming set of subdomain IDs.
virtual void addPostprocessors()
virtual void addUserObjects()
virtual void addDiracKernels()
virtual void initializePhysicsAdditional()
Additional initialization work that should happen very early, as soon as the problem is created.
virtual void act() override final
Forwards from the action tasks to the implemented addXYZ() in the derived classes If you need more th...
bool variableExists(const VariableName &var_name, bool error_if_aux) const
Check whether a variable already exists.
virtual void addVectorPostprocessors()
virtual void addAuxiliaryVariables()
virtual void addPreconditioning()
Factory & getFactory() const
MooseEnum _is_transient
Whether the physics is to be solved as a transient.
bool hasBlocks(const std::vector< SubdomainName > &blocks) const
Whether the Physics is defined on those blocks.
std::vector< VariableName > _aux_var_names
Vector of the aux variables in the Physics.
virtual std::vector< UserObjectName > getSuppliedUserObjects() const
Return the names of the UserObjects this Physics adds to the problem.
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
Get the solver system for this variable index.
virtual void addFunctorMaterials()
void saveAuxVariableName(const VariableName &var_name)
Keep track of the name of an aux variable defined in the Physics.
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
Returns whether this Physics should create the variable.
const ActionComponent & getActionComponent(const ComponentName &comp_name) const
Get a component with the requested name.
virtual InputParameters getAdditionalRMParams() const
Provide additional parameters for the relationship managers.
bool isVariableScalar(const VariableName &var_name) const
Whether the variable is a scalar variable (global single scalar, not a field)
virtual void addMaterials()
bool isVariableFV(const VariableName &var_name) const
Whether the variable is a finite volume variable.
virtual void addInterfaceKernels()
virtual void addFVKernels()
bool isTransient() const
Return whether the Physics is solved using a transient.
std::vector< SubdomainName > _blocks
Keep track of the subdomains the Physics is defined on.
const std::vector< SubdomainName > & blocks() const
Return the blocks this physics is defined on.
virtual void addNodalBCs()
const bool _verbose
Whether to output additional information.
virtual void addFEKernels()
virtual void addRelationshipManagers(Moose::RelationshipManagerType input_rm_type) override
Method to add a relationship manager for the objects being added to the system.
virtual void addSolverVariables()
The default implementation of these routines will do nothing as we do not expect all Physics to be de...
void checkRequiredTasks() const
Check the list of required tasks for missing tasks.
const MooseEnum & _preconditioning
Whether to add a default preconditioning.
virtual void addDGKernels()
void addRequiredPhysicsTask(const std::string &task)
Add a new required task for all physics deriving from this class NOTE: This does not register the tas...
virtual void addPeriodicBCs()
RelationshipManagerType
Main types of Relationship Managers.
const unsigned int invalid_uint