28 params.
addClassDescription(
"Creates all the objects necessary to solve a particular physics");
30 params.
addParam<std::vector<SubdomainName>>(
31 "block", {},
"Blocks (subdomains) that this Physics is active on.");
33 MooseEnum transient_options(
"true false same_as_problem",
"same_as_problem");
35 "transient", transient_options,
"Whether the physics is to be solved as a transient");
37 params.
addParam<
bool>(
"verbose",
false,
"Flag to facilitate debugging a Physics");
40 params.
addParam<std::vector<SolverSystemName>>(
43 "Name of the solver system(s) for the variables. If a single name is specified, "
44 "that system is used for all solver variables.");
45 MooseEnum pc_options(
"default defer",
"defer");
48 "Which preconditioning to use/add for this Physics, or whether to "
49 "defer to the Preconditioning block, or another Physics");
52 params.
addParam<
bool>(
"initialize_variables_from_mesh_file",
54 "Determines if the variables that are added by the action are initialized"
55 "from the mesh file (only for Exodus format)");
57 "initial_from_file_timestep",
59 "Gives the time step number (or \"LATEST\") for which to read the Exodus solution");
61 "Restart from Exodus");
64 params.
addParam<
bool>(
"dont_create_solver_variables",
66 "Whether to skip the 'add_variable'/'add_variables_physics' task(s)");
68 "dont_create_ics",
false,
"Whether to skip the 'add_ic'/'add_fv_ic/add_ics_physics' task(s)");
70 "dont_create_kernels",
false,
"Whether to skip the 'add_kernel' task for each kernel type");
71 params.
addParam<
bool>(
"dont_create_bcs",
73 "Whether to skip the 'add_bc' task for each boundary condition type");
74 params.
addParam<
bool>(
"dont_create_functions",
false,
"Whether to skip the 'add_function' task");
76 "dont_create_aux_variables",
false,
"Whether to skip the 'add_aux_variable' task");
78 "dont_create_aux_kernels",
false,
"Whether to skip the 'add_aux_kernel' task");
80 "dont_create_materials",
82 "Whether to skip the 'add_material'/'add_materials_physics' task(s) for each material type");
84 "dont_create_user_objects",
86 "Whether to skip the 'add_user_object' task. This does not apply to UserObject derived "
87 "classes being created on a different task (for example: postprocessors, VPPs, correctors)");
89 "dont_create_correctors",
false,
"Whether to skip the 'add_correctors' task");
91 "dont_create_postprocessors",
false,
"Whether to skip the 'add_postprocessors' task");
92 params.
addParam<
bool>(
"dont_create_vectorpostprocessors",
94 "Whether to skip the 'add_vectorpostprocessors' task");
96 "dont_create_solver_variables dont_create_ics dont_create_kernels dont_create_bcs "
97 "dont_create_functions dont_create_aux_variables dont_create_aux_kernels "
98 "dont_create_materials dont_create_user_objects dont_create_correctors "
99 "dont_create_postprocessors dont_create_vectorpostprocessors",
100 "Reduce Physics object creation");
110 _system_names(getParam<
std::vector<SolverSystemName>>(
"system_names")),
111 _verbose(getParam<bool>(
"verbose")),
112 _preconditioning(getParam<
MooseEnum>(
"preconditioning")),
113 _blocks(getParam<
std::vector<SubdomainName>>(
"block")),
114 _is_transient(getParam<
MooseEnum>(
"transient"))
117 "initial_from_file_timestep");
136 !getParam<bool>(
"dont_create_solver_variables"))
140 !getParam<bool>(
"dont_create_ics"))
144 else if (
_current_task ==
"add_interpolation_method_physics" &&
145 !getParam<bool>(
"dont_create_kernels"))
147 else if (
_current_task ==
"add_kernel" && !getParam<bool>(
"dont_create_kernels"))
149 else if (
_current_task ==
"add_nodal_kernel" && !getParam<bool>(
"dont_create_kernels"))
152 !getParam<bool>(
"dont_create_kernels"))
154 else if (
_current_task ==
"add_dirac_kernel" && !getParam<bool>(
"dont_create_kernels"))
156 else if (
_current_task ==
"add_dg_kernel" && !getParam<bool>(
"dont_create_kernels"))
158 else if (
_current_task ==
"add_scalar_kernel" && !getParam<bool>(
"dont_create_kernels"))
160 else if (
_current_task ==
"add_interface_kernel" && !getParam<bool>(
"dont_create_kernels"))
162 else if (
_current_task ==
"add_fv_ik" && !getParam<bool>(
"dont_create_kernels"))
166 else if (
_current_task ==
"add_bc" && !getParam<bool>(
"dont_create_bcs"))
168 else if (
_current_task ==
"add_nodal_bc" && !getParam<bool>(
"dont_create_bcs"))
171 !getParam<bool>(
"dont_create_bcs"))
173 else if (
_current_task ==
"add_periodic_bc" && !getParam<bool>(
"dont_create_bcs"))
177 else if (
_current_task ==
"add_function" && !getParam<bool>(
"dont_create_functions"))
179 else if (
_current_task ==
"add_aux_variable" && !getParam<bool>(
"dont_create_aux_variables"))
181 else if (
_current_task ==
"add_aux_kernel" && !getParam<bool>(
"dont_create_aux_kernels"))
184 !getParam<bool>(
"dont_create_materials"))
186 else if (
_current_task ==
"add_functor_material" && !getParam<bool>(
"dont_create_materials"))
196 else if (
_current_task ==
"add_user_object" && !getParam<bool>(
"dont_create_user_objects"))
198 else if (
_current_task ==
"add_corrector" && !getParam<bool>(
"dont_create_correctors"))
200 else if (
_current_task ==
"add_postprocessor" && !getParam<bool>(
"dont_create_postprocessors"))
203 !getParam<bool>(
"dont_create_vectorpostprocessors"))
235 const std::string & uo_name,
242 return std::find(supplied.begin(), supplied.end(), uo_name) != supplied.end();
244 "The UserObject '" + uo_name +
"' added by Physics '" +
name() +
245 "' was not declared in getSuppliedUserObjects(). Declare it there so its construction "
246 "order can be resolved.");
253 if (getParam<bool>(
"initialize_variables_from_mesh_file"))
257 "initial_from_file_timestep");
263 mooseAssert(
_problem,
"We don't have a problem yet");
275 mooseAssert(
_mesh,
"We dont have a mesh yet");
276 mooseAssert(
_dim < 4,
"Dimension has not been set yet");
283 const bool not_block_restricted =
286 mooseAssert(
_mesh,
"Should have a mesh");
290 std::set<SubdomainID> block_ids_set =
291 not_block_restricted ?
_mesh->meshSubdomains() :
_mesh->getSubdomainIDs(
blocks);
292 return block_ids_set;
295std::vector<std::string>
298 mooseAssert(
_mesh,
"Should have a mesh");
299 std::vector<std::string> sub_names_ids;
300 sub_names_ids.reserve(
blocks.size());
301 for (
const auto bid :
blocks)
303 const auto bname =
_mesh->getSubdomainName(bid);
304 sub_names_ids.push_back((bname.empty() ?
"(unnamed)" : bname) +
" (" + std::to_string(bid) +
307 return sub_names_ids;
323 if (block_ids.size())
325 for (
const auto bid : block_ids)
334 for (
const auto & block : component.
blocks())
359 "Empty block restriction is not supported. Comment out the Physics if you are "
360 "trying to disable it.");
364 _blocks.push_back(
"ANY_BLOCK_ID");
366 mooseAssert(
_mesh,
"We should have a mesh to find the dimension");
386 if (std::find(problem_nl_systems.begin(), problem_nl_systems.end(), sys_name) ==
387 problem_nl_systems.end() &&
388 std::find(problem_lin_systems.begin(), problem_lin_systems.end(), sys_name) ==
389 problem_lin_systems.end() &&
391 mooseError(
"System '", sys_name,
"' is not found in the Problem");
402 paramError(
"transient",
"We cannot solve a physics as transient in a steady problem");
407 "There should be one system name per solver variable (potentially repeated), or a "
408 "single system name for all variables. Currently you have '" +
409 std::to_string(
_system_names.size()) +
"' systems specified for '" +
413 unsigned int var_i = 0;
417 if (!
_problem->getSolverSystem(
_problem->solverSysNum(sys_name)).hasVariable(var_name) &&
418 !
_problem->getSolverSystem(
_problem->solverSysNum(sys_name)).hasScalarVariable(var_name))
420 "We expected system '" + sys_name +
"' to contain variable '" + var_name +
421 "' but it did not. Make sure the system names closely match the ordering of "
422 "the variables in the Physics.");
430 if (getParam<bool>(
"initialize_variables_from_mesh_file"))
432 mooseInfoRepeated(
"Adding Exodus restart for " + std::to_string(variables_to_copy.size()) +
435 for (
const auto i : index_range(variables_to_copy))
441 const auto & var_name = variables_to_copy[i];
443 var_name, var_name, getParam<std::string>(
"initial_from_file_timestep"));
450 const VariableName & var_name,
465 const VariableName & var_name,
476 const std::string & family,
477 const std::string & order,
480 const std::string var_type =
"MooseVariable";
484 params.
set<std::vector<Real>>(
"scaling") = {scaling};
490 const std::string & family,
491 const std::string & order)
493 const std::string var_type =
"MooseVariable";
503 if (error_if_aux &&
_problem->getAuxiliarySystem().hasVariable(var_name))
506 "' is supposed to be nonlinear for physics '",
508 "' but it is already defined as auxiliary");
510 return _problem->hasVariable(var_name);
516 return _problem->hasSolverVariable(var_name);
519const SolverSystemName &
522 mooseAssert(!
_system_names.empty(),
"We should have a solver system name");
531const SolverSystemName &
534 mooseAssert(!
_system_names.empty(),
"We should have a solver system name");
544 mooseError(
"Variable '", var_name,
"' was not found within the Physics solver variables.");
554 if (!registered_tasks.count(required_task))
556 "' has been declared as required by a Physics parent class of derived class '" +
558 "' but this task is not registered to the derived class. Registered tasks for "
559 "this Physics are: " +
570 params.
set<std::vector<SubdomainName>>(
"block") =
blocks;
572 mooseInfoRepeated(
"Empty block restriction assigned to an object created by Physics '" +
573 name() +
"'.\n Did you mean to do this?");
578 const std::vector<SubdomainName> &
blocks,
579 bool error_if_not_identical)
const
593 auto copy_blocks_other =
blocks;
594 std::sort(copy_blocks.begin(), copy_blocks.end());
595 copy_blocks.erase(unique(copy_blocks.begin(), copy_blocks.end()), copy_blocks.end());
596 std::sort(copy_blocks_other.begin(), copy_blocks_other.end());
597 copy_blocks_other.erase(unique(copy_blocks_other.begin(), copy_blocks_other.end()),
598 copy_blocks_other.end());
600 if (copy_blocks == copy_blocks_other)
602 std::vector<SubdomainName> diff;
603 std::set_difference(copy_blocks.begin(),
605 copy_blocks_other.begin(),
606 copy_blocks_other.end(),
607 std::inserter(diff, diff.begin()));
608 if (error_if_not_identical)
613 "' have different block restrictions.\nPhysics: ",
626 mooseAssert(
_blocks.size(),
"hasBlocks called before blocks were initialized");
627 return std::all_of(
blocks.begin(),
629 [
this](
const SubdomainName & block)
630 { return std::find(_blocks.begin(), _blocks.end(), block) != _blocks.end(); });
636 mooseAssert(
_mesh,
"The mesh should exist already");
640 else if (
blocks.size() !=
_mesh->meshSubdomains().size())
643 for (
const auto mesh_block :
_mesh->meshSubdomains())
645 const auto & subdomain_name =
_mesh->getSubdomainName(mesh_block);
647 if (!subdomain_name.empty() &&
651 else if (std::find(
blocks.begin(),
blocks.end(), std::to_string(mesh_block)) ==
blocks.end())
660 std::vector<SubdomainName> blocks_vec(
blocks.begin(),
blocks.end());
666 const std::vector<std::pair<MooseEnumItem, std::string>> & petsc_pair_options)
673 _problem->getSolverSystem(solver_sys_num).prefix(),
681 const auto var = &
_problem->getVariable(0, var_name);
688 return _problem->hasScalarVariable(var_name);
693 const std::vector<SubdomainName> &
blocks,
694 const bool error_if_aux)
699 auto & var =
_problem->getVariable(0, var_name);
700 const bool not_block_restricted =
703 if (!var.blockRestricted() || (!not_block_restricted && var.hasBlocks(
blocks)))
710 mooseError(
"Variable '" + var_name +
"' already exists with subdomain restriction '" +
711 Moose::stringify(var.blocks()) +
"' which does not include the subdomains '" +
717 const std::vector<SubdomainName> &
blocks,
718 const bool ic_is_default_ic,
719 const bool error_if_already_defined)
const
725 if (getParam<bool>(
"initialize_variables_from_mesh_file"))
728 mooseAssert(!
isVariableScalar(var_name),
"shouldCreateIC not implemented for scalar variables");
731 std::set<SubdomainName> blocks_set(
blocks.begin(),
blocks.end());
735 std::set<SubdomainID> blocks_ids_covered;
739 has_all_blocks =
_problem->getFVInitialConditionWarehouse().hasObjectsForVariableAndBlocks(
740 var_name, blocks_ids_set, blocks_ids_covered, 0);
742 std::set<SubdomainID> blocks_ids_covered_fe;
743 const bool has_all_blocks_from_feics =
744 _problem->getInitialConditionWarehouse().hasObjectsForVariableAndBlocks(
745 var_name, blocks_ids_set, blocks_ids_covered_fe, 0);
747 has_all_blocks = has_all_blocks || has_all_blocks_from_feics;
748 blocks_ids_covered.insert(blocks_ids_covered_fe.begin(), blocks_ids_covered_fe.end());
751 has_all_blocks =
_problem->getInitialConditionWarehouse().hasObjectsForVariableAndBlocks(
752 var_name, blocks_ids_set, blocks_ids_covered, 0);
754 const bool has_some_blocks = !blocks_ids_covered.empty();
755 if (!has_some_blocks)
760 if (error_if_already_defined)
761 mooseError(
"ICs for variable '" + var_name +
"' have already been defined for blocks '" +
768 mooseError(
"There is a partial overlap between the subdomains covered by pre-existing initial "
769 "conditions (ICs), defined on blocks (ids): " +
771 "\n and a newly created IC for variable '" + var_name +
773 ".\nWe should be creating the Physics' IC only for non-covered blocks. This is not "
774 "implemented at this time.");
779 const std::vector<SubdomainName> &
blocks,
780 const bool error_if_already_defined)
const
790 "shouldCreateTimeDerivative not implemented for scalar variables");
791 mooseAssert(!
_problem->hasAuxiliaryVariable(var_name),
792 "Should not be called with auxiliary variables");
795 const auto var = &
_problem->getVariable(0, var_name);
796 const auto var_id = var->number();
797 const auto sys_num = var->sys().number();
798 const auto time_vector_tag =
799 (sys_num <
_problem->numNonlinearSystems())
800 ? var->sys().timeVectorTag()
802 :
dynamic_cast<LinearSystem *
>(&var->sys())->rightHandSideTimeVectorTag();
805 bool all_blocks_covered =
true;
806 std::set<SubdomainID> blocks_ids_covered;
809 for (
const auto & block :
blocks)
811 std::vector<MooseObject *> time_kernels;
812 if (block !=
"ANY_BLOCK_ID")
814 const auto bid =
_mesh->getSubdomainID(block);
817 .template condition<AttribSysNum>(sys_num)
818 .template condition<AttribVar>(var_id)
819 .template condition<AttribSubdomains>(bid)
821 .template condition<AttribVectorTags>(time_vector_tag)
822 .queryInto(time_kernels);
827 .template condition<AttribSysNum>(sys_num)
828 .template condition<AttribVar>(var_id)
830 .template condition<AttribVectorTags>(time_vector_tag)
831 .queryInto(time_kernels);
833 if (time_kernels.size())
835 if (block ==
"ANY_BLOCK_ID")
837 for (
const auto & time_kernel : time_kernels)
839 blocks_ids_covered.insert(blk->blockIDs().begin(), blk->blockIDs().end());
842 blocks_ids_covered.insert(
_mesh->getSubdomainID(block));
845 all_blocks_covered =
false;
849 if (all_blocks_covered)
851 std::set<SubdomainName> blocks_set(
blocks.begin(),
blocks.end());
853 if (blocks_ids != blocks_ids_covered)
854 all_blocks_covered =
false;
856 const bool has_some_blocks = !blocks_ids_covered.empty();
857 if (!has_some_blocks)
859 if (all_blocks_covered)
861 if (error_if_already_defined)
862 mooseError(
"A time kernel for variable '" + var_name +
869 mooseError(
"There is a partial overlap between the subdomains covered by pre-existing time "
870 "derivative kernel(s), defined on blocks (ids): " +
872 "\nand a newly created time derivative kernel for variable " + var_name +
874 ".\nWe should be creating the Physics' time derivative only for non-covered "
875 "blocks. This is not implemented at this time.");
880 const std::string & object_type,
881 const std::string & object_name)
const
883 std::vector<std::string> defaults_unused;
884 std::vector<std::string> user_values_unused;
885 for (
const auto & param : param_names)
888 user_values_unused.push_back(param);
890 defaults_unused.push_back(param);
892 const std::string object_name_string =
893 object_name.empty() ?
"" : (
"and name '" + object_name +
"' ");
895 if (defaults_unused.size() &&
_verbose)
897 "' for object of type '" + object_type +
"' " + object_name_string +
898 "were not used because the object was not created by this Physics.");
899 if (user_values_unused.size())
903 "User-specifed values for parameters '" +
Moose::stringify(user_values_unused) +
904 "' for object of type '" + object_type +
"' " + object_name_string +
905 "were not used because the corresponding object was not created by this Physics.");
908 "' for object of type '" + object_type +
"' " + object_name_string +
909 "were not used because the corresponding object was not created by this Physics.");
void mooseInfoRepeated(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Base class for components that are defined using an action.
const std::vector< SubdomainName > & blocks() const
Returns the subdomains for the component mesh, if any.
std::set< std::string > getTasksByAction(const std::string &action) const
const T & getAction(const std::string &name) const
Retrieve an action with its name and the desired type.
std::shared_ptr< MooseMesh > & _mesh
static InputParameters validParams()
MooseApp & _app
The MOOSE application this is associated with.
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.
const std::string & _current_task
The current action (even though we have separate instances for each action)
ActionWarehouse & _awh
Reference to ActionWarehouse where we store object build by actions.
An interface that restricts an object to subdomains via the 'blocks' input parameter.
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
virtual const SystemBase & systemBaseAuxiliary() const override
Return the auxiliary system object as a base class reference.
void setVerboseProblem(bool verbose)
Make the problem be verbose.
unsigned int solverSysNum(const SolverSystemName &solver_sys_name) const override
const std::vector< LinearSystemName > & getLinearSystemNames() const
const std::vector< NonlinearSystemName > & getNonlinearSystemNames() const
virtual bool isTransient() const override
virtual const SystemBase & getSystemBase(const unsigned int sys_num) const
Get constant reference to a system in this problem.
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
Linear system to be solved.
bool unusedFlagIsError() const
Returns whether the flag for unused parameters is set to throw an error.
void setExodusFileRestart(bool flag)
Set the flag to indicate whether or not we need to use a separate Exodus reader to read the mesh BEFO...
bool isRestarting() const
Whether or not this is a "restart" calculation.
bool isRecovering() const
Whether or not this is a "recover" calculation.
bool unusedFlagIsWarning() const
Returns whether the flag for unused parameters is set to throw a warning only.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
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...
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
A struct for storing the various types of petsc options and values.
ActionFactory & _action_factory
Builds Actions.
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.
void addSharedAuxVariable(const std::string &var_type, const VariableName &var_name, const InputParameters ¶ms)
Same as addSharedSolverVariable() but for an auxiliary variable, from addAuxiliaryVariables()
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...
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()
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()
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.
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()
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.
PhysicsBase(const InputParameters ¶meters)
void addSharedSolverVariable(const std::string &var_type, const VariableName &var_name, InputParameters params)
Requests a solver variable that may be shared with other Physics, on the blocks of this Physics.
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.
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()
static PhysicsVariableCoordinator & findOrCreate(ActionWarehouse &awh, ActionFactory &action_factory)
Finds this simulation's coordinator, creating it and adding it to awh (using action_factory) if it do...
void requestVariable(bool nl, const std::string &var_type, const VariableName &var_name, const InputParameters ¶ms, const std::vector< SubdomainName > &blocks, const std::string &requester)
Requests that a shared variable be created on blocks, in addition to any blocks already requested for...
void mooseWarning(Args &&... args) const
Base class for a system (of equations)
virtual void addVariableToCopy(const std::string &dest_name, const std::string &source_name, const std::string ×tep)
Add info about variable that will be copied.
void addPetscPairsToPetscOptions(const std::vector< std::pair< MooseEnumItem, std::string > > &petsc_pair_options, const unsigned int mesh_dimension, std::string prefix, const ParallelParamObject ¶m_object, PetscOptions &petsc_options)
Populate name and value pairs in a given PetscOptions object using vectors of input arguments.
std::string stringify(const T &t)
conversion to string
RelationshipManagerType
Main types of Relationship Managers.