15 #include "libmesh/mesh_base.h" 16 #include "libmesh/elem_range.h" 17 #include "libmesh/numeric_vector.h" 18 #include "libmesh/mesh_tools.h" 38 params.suppressParameter<
bool>(
"force_preic");
40 params.addParam<NonlinearVariableName>(
"variable",
NS::pressure,
"Pressure variable");
41 params.addParam<PostprocessorName>(
"phi0",
"0",
"Pressure pin value");
42 MooseEnum pin_types(
"point-value average");
43 params.addRequiredParam<
MooseEnum>(
"pin_type", pin_types,
"How to pin the pressure");
44 params.addParam<
Point>(
46 "The XYZ coordinates of a point inside an element where the pinned value shall be enforced.");
47 params.addParam<PostprocessorName>(
48 "pressure_average",
"A postprocessor that computes the average of the pressure variable");
50 params.addClassDescription(
"Pins the pressure after a solve");
51 params.registerBase(
"Corrector");
61 _p(
UserObject::_subproblem.getVariable(0, getParam<NonlinearVariableName>(
"variable"))),
62 _p0(getPostprocessorValue(
"phi0")),
63 _pressure_pin_type(getParam<
MooseEnum>(
"pin_type")),
64 _pressure_pin_point(_pressure_pin_type ==
"point-value" ? getParam<
Point>(
"point")
66 _current_pressure_average(
67 _pressure_pin_type ==
"average" ? &getPostprocessorValue(
"pressure_average") : nullptr),
68 _sys(*getCheckedPointerParam<
SystemBase *>(
"_sys"))
75 mooseAssert(!Threads::in_threads,
"paramError is not safe in threaded mode");
83 "Pressure average postprocessor must include the pin execute_on flags");
102 pl->enable_out_of_mesh_mode();
105 auto elem_id = elem ? elem->id() : DofObject::invalid_id;
108 if (elem_id == DofObject::invalid_id)
111 pl->disable_out_of_mesh_mode();
114 pin_value =
_p0 - point_value;
121 std::set<dof_id_type> local_dofs;
123 for (
const auto dof : local_dofs)
124 sln.
add(dof, pin_value);
void local_dof_indices(const unsigned int var, std::set< dof_id_type > &var_indices) const
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
virtual void initialSetup() override
const PostprocessorValue & _p0
Value of the pressure pin.
std::unique_ptr< PointLocatorBase > sub_point_locator() const
T & getMesh(MooseMesh &mesh)
function to cast mesh
static InputParameters validParams()
NumericVector< Number > & solution()
unsigned int number() const
const ExecFlagType EXEC_NONE
virtual libMesh::System & system()=0
const PostprocessorValue *const _current_pressure_average
If using average pressure pin, provides the average pressure value.
Number point_value(unsigned int var, const Point &p, const bool insist_on_success=true, const NumericVector< Number > *sol=nullptr) const
const ExecFlagType EXEC_TIMESTEP_END
NSPressurePin(const InputParameters ¶ms)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
static InputParameters validParams()
const ExecFlagType EXEC_TIMESTEP_BEGIN
registerMooseObjectRenamed("NavierStokesApp", NSFVPressurePin, "01/19/2025 00:00", NSPressurePin)
const ExecFlagEnum & getExecuteOnEnum() const
void paramError(const std::string ¶m, Args... args) const
bool isValueSet(const std::string &value) const
static InputParameters validParams()
const ExecFlagType EXEC_LINEAR
const Point _pressure_pin_point
If using point-value pressure pin, the point at which to apply the pin.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
FEProblemBase & _fe_problem
This user-object corrects the pressure.
static const std::string pressure
void removeAvailableFlags(const ExecFlagType &flag, Args... flags)
void mooseError(Args &&... args) const
const MooseEnum _pressure_pin_type
Pressure pin type.
virtual void execute() override
const MooseVariableFieldBase & _p
The thread 0 copy of the pressure variable.
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
virtual void add(const numeric_index_type i, const T value)=0
registerMooseObject("NavierStokesApp", NSPressurePin)
SystemBase & _sys
The nonlinear system.
MeshBase & _mesh
LibMesh mesh class for the current simulation mesh.