21 params.
addClassDescription(
"Retrieves a field value from the closest node on the paired boundary " 22 "and stores it on this boundary or block.");
23 params.
set<
bool>(
"_dual_restrictable") =
true;
24 params.
addRequiredParam<BoundaryName>(
"paired_boundary",
"The boundary to get the value from.");
26 params.
set<
bool>(
"use_displaced_mesh") =
true;
33 getNearestNodeLocator(parameters.
get<BoundaryName>(
"paired_boundary"), boundaryNames()[0])),
34 _serialized_solution(_nl_sys.currentSolution()),
35 _paired_variable(coupled(
"paired_variable"))
38 paramError(
"boundary",
"NearestNodeValueAux can only be used with one boundary at a time!");
40 paramError(
"boundary",
"Should be specified on a boundary");
44 paramError(
"paired_variable",
"Paired variable should not be auxiliary");
48 paramError(
"paired_variable",
"Paired variable does not have degrees of freedom on nodes");
60 if (nearest ==
nullptr)
64 mooseError(
"Paired variable does not seem to be defined on nearest node: ",
72 Real sum_inv_dist = 0;
83 mooseError(
"Paired variable does not seem to be defined on nearest node: ",
89 average += (*_serialized_solution)(dof_number) /
distance;
95 average += (*_serialized_solution)(dof_number);
100 if (sum_inv_dist > 0)
101 return average / sum_inv_dist;
static InputParameters validParams()
const NumericVector< Number > *const & _serialized_solution
registerMooseObject("MooseApp", NearestNodeValueAux)
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 ...
const Node *const & _current_node
Current node (valid only for nodal kernels)
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Real distance(dof_id_type node_id)
Valid to call this after findNodes() has been called to get the distance to the nearest node...
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
Extract pointer to a coupled variable.
bool hasDoFsOnNodes() const override
Does this variable have DoFs on nodes.
Real distance(const Point &p)
static const dof_id_type invalid_id
NearestNodeLocator & _nearest_node
unsigned int number() const
Gets the number of this system.
virtual Real computeValue() override
Compute and return the value of the aux variable.
Finds the closest node on a paired boundary to the current node or element and stores a corresponding...
NearestNodeValueAux(const InputParameters ¶meters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Node * nearestNode(dof_id_type node_id)
Valid to call this after findNodes() has been called to get a pointer to the nearest node...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
SubProblem & _subproblem
Subproblem this kernel is part of.
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
static InputParameters validParams()
unsigned int _paired_variable
const std::vector< BoundaryName > & boundaryNames() const
Return the boundary names for this object.
bool isNodal() const
Nodal or elemental kernel?
virtual bool hasAuxiliaryVariable(const std::string &var_name) const
Whether or not this problem has this auxiliary variable.