24 "bounded_var",
"Variable whose value will be constrained to be greater than lower_var");
27 "Variable that acts as a lower bound to bounded_var. It will not be " 28 "constrained during the solution procedure");
37 _bounded_var_name(params.
get<NonlinearVariableName>(
"bounded_var")),
38 _lower_var_name(params.
get<NonlinearVariableName>(
"lower_var")),
56 tid,
_bounded_var_name, Moose::VarKindType::VAR_ANY, Moose::VarFieldType::VAR_FIELD_STANDARD);
58 tid,
_lower_var_name, Moose::VarKindType::VAR_ANY, Moose::VarFieldType::VAR_FIELD_STANDARD);
62 mooseError(
"Both the bounded and lower variables must be nodal variables in " 63 "RichardsMultiphaseProblem");
65 mooseError(
"Both the bounded and lower variables must belong to the same element family, eg " 66 "LAGRANGE, in RichardsMultiphaseProblem");
68 mooseError(
"Both the bounded and lower variables must have the same order, eg FIRST, in " 69 "RichardsMultiphaseProblem");
88 bool updatedSolution =
96 for (
const auto & node :
_mesh.
getMesh().local_node_ptr_range())
100 std::vector<dof_id_type> dofs(2);
106 std::vector<Number> soln(2);
107 vec_solution.
get(dofs, soln);
110 if (soln[0] < soln[1])
112 vec_solution.
set(dofs[0], soln[1]);
113 updatedSolution =
true;
120 vec_solution.
close();
127 ghosted_solution = vec_solution;
128 ghosted_solution.
close();
131 return updatedSolution;
NonlinearVariableName _bounded_var_name
name of the bounded variable (this is the variable that gets altered to respect bounded_var > lower_v...
virtual ~RichardsMultiphaseProblem()
virtual bool isNodal() const
NonlinearVariableName _lower_var_name
name of the variable that acts as the lower bound to bounded_var
virtual void get(const std::vector< numeric_index_type > &index, Number *values) const
virtual bool shouldUpdateSolution()
returns true, indicating that updateSolution should be run
unsigned int number() const
RichardsMultiphaseProblem(const InputParameters ¶ms)
const Parallel::Communicator & _communicator
unsigned int _bounded_var_num
internal moose variable number associated with _bounded_var
static InputParameters validParams()
const FEType & feType() const
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
unsigned int _lower_var_num
internal moose variable number associated with _lower_var
virtual void initialSetup()
extracts the moose variable numbers associated with bounded_var and lower_var
Allows a constraint u>=v to be enforced during the nonlinear iteration process.
virtual bool updateSolution(NumericVector< Number > &vec_solution, NumericVector< Number > &ghosted_solution)
Does the bounding by modifying vec_solution, and then ghosted_solution.
void initialSetup() override
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
unsigned int number() const
void max(const T &r, T &o, Request &req) const
registerMooseObject("RichardsApp", RichardsMultiphaseProblem)
void mooseError(Args &&... args) const
static InputParameters validParams()
virtual void set(const numeric_index_type i, const Number value)=0
const Elem & get(const ElemType type_in)