23 params.
addClassDescription(
"Add diffusion physics discretized with cell-centered finite volume");
27 "Functor specifying the diffusivity");
30 "ghost_layers", 2,
"Number of ghosting layers for distributed memory parallel calculations");
51 const std::string kernel_type =
"FVDiffusion";
54 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
55 params.
set<MooseFunctorName>(
"coeff") = getParam<MooseFunctorName>(
"diffusivity_functor");
62 std::string kernel_type;
64 const auto & source = getParam<MooseFunctorName>(
"source_functor");
66 getProblem().hasPostprocessorValueByName(source))
67 kernel_type =
"FVBodyForce";
69 kernel_type =
"FVCoupledForce";
72 "No kernel defined for a source term in FV for the type used for '",
77 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
81 const auto coef = getParam<Real>(
"source_coef");
83 params.
set<Real>(
"value") = MooseUtils::convert<Real>(source) * coef;
86 params.
set<Real>(
"value") = coef;
87 params.
set<FunctionName>(
"function") = source;
91 params.
set<Real>(
"value") = coef;
92 params.
set<PostprocessorName>(
"postprocessor") = source;
96 params.
set<Real>(
"coef") = coef;
97 params.
set<MooseFunctorName>(
"v") = {source};
105 const std::string kernel_type =
"FVTimeKernel";
107 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
118 const auto & boundary_fluxes = getParam<std::vector<MooseFunctorName>>(
"boundary_fluxes");
121 const auto & bc_flux = boundary_fluxes[i];
123 std::string bc_type =
"";
125 bc_type =
"FVNeumannBC";
127 bc_type =
"FVFunctionNeumannBC";
129 bc_type =
"FVFunctorNeumannBC";
132 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
137 params.
set<Real>(
"value") = MooseUtils::convert<Real>(bc_flux);
139 params.
set<FunctionName>(
"function") = bc_flux;
141 params.
set<MooseFunctorName>(
"functor") = bc_flux;
150 const auto & boundary_values = getParam<std::vector<MooseFunctorName>>(
"boundary_values");
153 const auto & bc_value = boundary_values[i];
155 std::string bc_type =
"";
157 bc_type =
"FVDirichletBC";
159 bc_type =
"FVFunctionDirichletBC";
161 bc_type =
"FVADFunctorDirichletBC";
164 params.
set<NonlinearVariableName>(
"variable") =
_var_name;
169 params.
set<Real>(
"value") = MooseUtils::convert<Real>(bc_value);
171 params.
set<FunctionName>(
"function") = bc_value;
173 params.
set<MooseFunctorName>(
"functor") = bc_value;
190 const std::string variable_type =
"MooseVariableFVReal";
200 const auto necessary_layers =
201 std::max(getParam<unsigned short>(
"ghost_layers"), (
unsigned short)2);
204 const std::string kernel_type =
"FVDiffusion";
206 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 ...
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)