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");
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;
std::string prefix() const
Use prefix() to disambiguate names.
virtual bool hasVariable(const std::string &var_name) const override
Whether or not this problem has the variable.
bool parsesToReal(const std::string &input)
Check if the input string can be parsed into a Real.
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.
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
Returns whether this Physics should create the variable.
static InputParameters validParams()
Factory & getFactory()
Get the factory for this physics The factory lets you get the parameters for objects.
const std::vector< BoundaryName > & _neumann_boundaries
Boundaries on which a Neumann boundary condition is applied.
virtual void needFV() override
marks this problem as including/needing finite volume functionality.
Base class to help creating an entire physics.
InputParameters getValidParams(const std::string &name) const
Get valid parameters for the object.
registerMooseAction("MooseApp", DiffusionFV, "add_fv_kernel")
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.
const VariableName & _var_name
Name of the diffused variable.
std::vector< SubdomainName > _blocks
Keep track of the subdomains the Physics is defined on.
auto max(const L &left, const R &right)
virtual void addFVBCs() override
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
registerDiffusionPhysicsBaseTasks("MooseApp", DiffusionFV)
virtual FEProblemBase & getProblem()
Get the problem for this physics Useful to add objects to the simulation.
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
Get the solver system for this variable index.
Creates all the objects needed to solve a diffusion equation with a cell-centered finite volume discr...
Interface class to help components interact with Physics.
bool hasPostprocessorValueByName(const PostprocessorName &name) const
Whether or not a Postprocessor value exists by a given name.
const std::vector< BoundaryName > & _dirichlet_boundaries
Boundaries on which a Dirichlet boundary condition is applied.
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 ...
static InputParameters validParams()
DiffusionFV(const InputParameters ¶meters)
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters ¶ms)
Canonical method for adding a non-linear variable.
virtual void addSolverVariables() override
The default implementation of these routines will do nothing as we do not expect all Physics to be de...
virtual void initializePhysicsAdditional() override
Additional initialization work that should happen very early, as soon as the problem is created...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void reportPotentiallyMissedParameters(const std::vector< std::string > ¶m_names, const std::string &object_type) const
When this is called, we are knowingly not using the value of these parameters.
virtual void addFVKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
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 InputParameters getAdditionalRMParams() const override
Provide additional parameters for the relationship managers.
virtual void addFVKernels() override
auto index_range(const T &sizable)
Base class to host all common parameters and attributes of Physics actions to solve the diffusion equ...