16 params.
addClassDescription(
"This Auxkernel solves a least squares problem at each node to fit a "
17 "value from quantities defined on quadrature points.");
19 "nodal_patch_recovery_uo",
20 "The name of the userobject that sets up the least squares problem of the nodal patch.");
36 auto node_to_elem_pair = node_to_elem_map.find(
_current_node->id());
37 mooseAssert(node_to_elem_pair != node_to_elem_map.end(),
"Missing entry in node to elem map");
46 for (
auto & n :
_mesh.
elemPtr(elem_id)->node_ref_range())
48 node_to_elem_pair = node_to_elem_map.find(n.id());
49 std::vector<dof_id_type> elem_ids_candidate = node_to_elem_pair->second;
50 if (elem_ids_candidate.size() >
_elem_ids.size())
52 std::vector<dof_id_type> elem_ids_candidate_restricted;
55 if (elem_ids_candidate_restricted.size() >
_elem_ids.size())
56 _elem_ids = elem_ids_candidate_restricted;
67 std::vector<dof_id_type> & elem_ids,
68 const std::vector<dof_id_type> & node_to_elem_pair_elems)
const
71 for (
auto elem_id : node_to_elem_pair_elems)
73 for (
const auto block_id :
blockIDs())
75 elem_ids.push_back(elem_id);
78 elem_ids = node_to_elem_pair_elems;
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
MooseMesh & _mesh
Mesh this kernel is active on.
bool isNodal() const
Nodal or elemental kernel?
const Node *const & _current_node
Current node (valid only for nodal kernels)
static InputParameters validParams()
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted,...
virtual bool blockRestricted() const
Returns true if this object has been restricted to a block.
const std::string & name() const
Get the name of the class.
virtual Elem * elemPtr(const dof_id_type i)
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected.
virtual Real computeValue() override
Compute and return the value of the aux variable.
virtual Real nodalPatchRecovery()=0
Override this to get the fitted value from a Nodal Patch Recovery User Object.
std::vector< dof_id_type > _elem_ids
local patch of elements used for recovery
void blockRestrictElements(std::vector< dof_id_type > &elem_ids, const std::vector< dof_id_type > &node_to_elem_pair_elems) const
Block restrict elements on which to perform the variable/property nodal recovery.
NodalPatchRecoveryAuxBase(const InputParameters ¶meters)
static InputParameters validParams()