13 #include "MooseMesh.h"
14 #include "MooseVariable.h"
15 #include "NonlinearSystem.h"
23 InputParameters params = validParams<FEProblemBase>();
24 params.addRequiredParam<NonlinearVariableName>(
25 "bounded_var",
"Variable whose value will be constrained to be greater than lower_var");
26 params.addRequiredParam<NonlinearVariableName>(
28 "Variable that acts as a lower bound to bounded_var. It will not be "
29 "constrained during the solution procedure");
38 _bounded_var_name(params.get<NonlinearVariableName>(
"bounded_var")),
39 _lower_var_name(params.get<NonlinearVariableName>(
"lower_var")),
56 MooseVariableFEBase & bounded = getVariable(
57 tid,
_bounded_var_name, Moose::VarKindType::VAR_ANY, Moose::VarFieldType::VAR_FIELD_STANDARD);
58 MooseVariableFEBase & lower = getVariable(
59 tid,
_lower_var_name, Moose::VarKindType::VAR_ANY, Moose::VarFieldType::VAR_FIELD_STANDARD);
62 if (!bounded.isNodal() || !lower.isNodal())
63 mooseError(
"Both the bounded and lower variables must be nodal variables in "
64 "RichardsMultiphaseProblem");
65 if (bounded.feType().family != lower.feType().family)
66 mooseError(
"Both the bounded and lower variables must belong to the same element family, eg "
67 "LAGRANGE, in RichardsMultiphaseProblem");
68 if (bounded.feType().order != lower.feType().order)
69 mooseError(
"Both the bounded and lower variables must have the same order, eg FIRST, in "
70 "RichardsMultiphaseProblem");
76 FEProblemBase::initialSetup();
87 NumericVector<Number> & ghosted_solution)
89 bool updatedSolution =
92 unsigned int sys_num = getNonlinearSystemBase().number();
97 for (
const auto & node : _mesh.getMesh().local_node_ptr_range())
101 std::vector<dof_id_type> dofs(2);
107 std::vector<Number> soln(2);
108 vec_solution.get(dofs, soln);
111 if (soln[0] < soln[1])
113 vec_solution.set(dofs[0], soln[1]);
114 updatedSolution =
true;
121 vec_solution.close();
124 _communicator.max(updatedSolution);
128 ghosted_solution = vec_solution;
129 ghosted_solution.close();
132 return updatedSolution;