23 params.
addClassDescription(
"Add diffusion physics discretized with cell-centered finite volume");
25 params.
suppressParameter<std::vector<MaterialPropertyName>>(
"diffusivity_matprop");
26 params.
addRequiredParam<std::vector<MooseFunctorName>>(
"diffusivity_functor",
27 "Functor specifying the diffusivity");
30 "ghost_layers", 2,
"Number of ghosting layers for distributed memory parallel calculations");
50 unsigned int num_diffusion_terms = 1;
52 num_diffusion_terms = getParam<std::vector<MooseFunctorName>>(
"diffusivity_functor").size();
54 for (
const auto i_diff_block_group : make_range(num_diffusion_terms))
56 const std::string kernel_type =
"FVDiffusion";
60 getParam<std::vector<std::vector<SubdomainName>>>(
61 "diffusivity_blocks")[i_diff_block_group]);
64 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
65 params.
set<MooseFunctorName>(
"coeff") =
66 getParam<std::vector<MooseFunctorName>>(
"diffusivity_functor")[i_diff_block_group];
73 std::string kernel_type;
75 const auto & source = getParam<MooseFunctorName>(
"source_functor");
77 getProblem().hasPostprocessorValueByName(source))
78 kernel_type =
"FVBodyForce";
80 kernel_type =
"FVCoupledForce";
83 "No kernel defined for a source term in FV for the type used for '",
88 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
92 const auto coef = getParam<Real>(
"source_coef");
94 params.
set<Real>(
"value") = MooseUtils::convert<Real>(source) * coef;
97 params.
set<Real>(
"value") = coef;
98 params.
set<FunctionName>(
"function") = source;
102 params.
set<Real>(
"value") = coef;
103 params.
set<PostprocessorName>(
"postprocessor") = source;
107 params.
set<Real>(
"coef") = coef;
108 params.
set<MooseFunctorName>(
"v") = {source};
116 const std::string kernel_type =
"FVTimeKernel";
118 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
129 const auto & boundary_fluxes = getParam<std::vector<MooseFunctorName>>(
"boundary_fluxes");
132 const auto & bc_flux = boundary_fluxes[i];
134 std::string bc_type =
"";
136 bc_type =
"FVNeumannBC";
138 bc_type =
"FVFunctionNeumannBC";
140 bc_type =
"FVFunctorNeumannBC";
143 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
148 params.
set<Real>(
"value") = MooseUtils::convert<Real>(bc_flux);
150 params.
set<FunctionName>(
"function") = bc_flux;
152 params.
set<MooseFunctorName>(
"functor") = bc_flux;
161 const auto & boundary_values = getParam<std::vector<MooseFunctorName>>(
"boundary_values");
164 const auto & bc_value = boundary_values[i];
166 std::string bc_type =
"";
168 bc_type =
"FVDirichletBC";
170 bc_type =
"FVFunctionDirichletBC";
172 bc_type =
"FVADFunctorDirichletBC";
175 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
180 params.
set<Real>(
"value") = MooseUtils::convert<Real>(bc_value);
182 params.
set<FunctionName>(
"function") = bc_value;
184 params.
set<MooseFunctorName>(
"functor") = bc_value;
201 const std::string variable_type =
"MooseVariableFVReal";
211 const auto necessary_layers =
212 std::max(getParam<unsigned short>(
"ghost_layers"), (
unsigned short)2);
215 const std::string kernel_type =
"FVDiffusion";
217 params.template set<unsigned short>(
"ghost_layers") = necessary_layers;
registerMooseAction("MooseApp", DiffusionFV, "add_fv_kernel")
registerDiffusionPhysicsBaseTasks("MooseApp", DiffusionFV)
Creates all the objects needed to solve a diffusion equation with a cell-centered finite volume discr...
virtual void initializePhysicsAdditional() override
Additional initialization work that should happen very early, as soon as the problem is created.
virtual void addFVKernels() override
virtual void addSolverVariables() override
The default implementation of these routines will do nothing as we do not expect all Physics to be de...
static InputParameters validParams()
virtual InputParameters getAdditionalRMParams() const override
Provide additional parameters for the relationship managers.
DiffusionFV(const InputParameters ¶meters)
virtual void addFVBCs() override
Base class to host all common parameters and attributes of Physics actions to solve the diffusion equ...
const std::vector< BoundaryName > & _neumann_boundaries
Boundaries on which a Neumann boundary condition is applied.
const VariableName & _var_name
Name of the diffused variable.
static InputParameters validParams()
const std::vector< BoundaryName > & _dirichlet_boundaries
Boundaries on which a Dirichlet boundary condition is applied.
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
Canonical method for adding a non-linear variable.
bool hasPostprocessorValueByName(const PostprocessorName &name) const
Whether or not a Postprocessor value exists by a given name.
virtual void needFV() override
marks this problem as including/needing finite volume functionality.
virtual void addFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters ¶meters)
virtual bool hasFunction(const std::string &name, const THREAD_ID tid=0)
virtual void addFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
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 ...
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Base class to help creating an entire physics.
virtual FEProblemBase & getProblem()
Get the problem for this physics Useful to add objects to the simulation.
Factory & getFactory()
Get the factory for this physics The factory lets you get the parameters for objects.
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.
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.
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.
std::string prefix() const
Use prefix() to disambiguate names.
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
Get the solver system for this variable index.
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
Returns whether this Physics should create the variable.
std::vector< SubdomainName > _blocks
Keep track of the subdomains the Physics is defined on.
Interface class to help components interact with Physics.
bool parsesToReal(const std::string &input, Real *parsed_real)