https://mooseframework.inl.gov
BoundaryNodeIntegrityCheckThread.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // MOOSE includes
13 #include "AuxiliarySystem.h"
14 #include "NonlinearSystemBase.h"
15 #include "FEProblemBase.h"
16 #include "NodalUserObject.h"
17 #include "MooseMesh.h"
19 
20 #include "libmesh/threads.h"
21 #include "libmesh/node.h"
22 #include "libmesh/mesh_base.h"
23 
24 #include <vector>
25 
27  FEProblemBase & fe_problem, const TheWarehouse::Query & query)
28  : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem),
29  _aux_sys(fe_problem.getAuxiliarySystem()),
30  _nodal_aux(_aux_sys.nodalAuxWarehouse()),
31  _nodal_vec_aux(_aux_sys.nodalVectorAuxWarehouse()),
32  _nodal_array_aux(_aux_sys.nodalArrayAuxWarehouse()),
33  _query(query),
34  _node_to_elem_map(fe_problem.mesh().nodeToActiveSemilocalElemMap())
35 {
36 }
37 
38 // Splitting Constructor
42  _aux_sys(x._aux_sys),
43  _nodal_aux(x._nodal_aux),
44  _nodal_vec_aux(x._nodal_vec_aux),
45  _nodal_array_aux(x._nodal_array_aux),
46  _query(x._query),
47  _node_to_elem_map(x._node_to_elem_map)
48 {
49 }
50 
51 void
53 {
54  const BndNode * const bnode = *node_it;
55  const auto boundary_id = bnode->_bnd_id;
56  const Node * const node = bnode->_node;
57 
58  // We can distribute work just as the actual execution code will
59  if (node->processor_id() != _fe_problem.processor_id())
60  return;
61 
62  auto & mesh = _fe_problem.mesh();
63 
64  // Only check vertices. Variables may not be defined on non-vertex nodes (think first order
65  // Lagrange on a second order mesh) and user-code can often handle that
66  const Elem * const an_elem =
67  mesh.getMesh().elem_ptr(libmesh_map_find(_node_to_elem_map, node->id()).front());
68  if (!an_elem->is_vertex(an_elem->get_node_index(node)))
69  return;
70 
71  const auto & bnd_name = mesh.getBoundaryName(boundary_id);
72 
73  // uo check
74  std::vector<NodalUserObject *> objs;
75  _query.clone()
77  .condition<AttribInterfaces>(Interfaces::NodalUserObject)
78  .condition<AttribBoundaries>(boundary_id, true)
79  .queryInto(objs);
80  for (const auto & uo : objs)
81  if (uo->checkVariableBoundaryIntegrity())
82  boundaryIntegrityCheckError(*uo, uo->checkAllVariables(*node), bnd_name);
83 
84  auto check = [node, boundary_id, &bnd_name, this](const auto & warehouse)
85  {
86  if (!warehouse.hasBoundaryObjects(boundary_id, _tid))
87  return;
88 
89  const auto & bnd_objects = warehouse.getBoundaryObjects(boundary_id, _tid);
90  for (const auto & bnd_object : bnd_objects)
91  // Skip if this object uses geometric search because coupled variables may be defined on
92  // paired boundaries instead of the boundary this node is on
93  if (!bnd_object->requiresGeometricSearch() && bnd_object->checkVariableBoundaryIntegrity())
94  boundaryIntegrityCheckError(*bnd_object, bnd_object->checkAllVariables(*node), bnd_name);
95  };
96 
100 }
101 
102 void
104 {
105 }
const ExecuteMooseObjectWarehouse< ArrayAuxKernel > & _nodal_array_aux
Nodal auxiliary kernels acting on array field variables.
QueryCache is a convenient way to construct and pass around (possible partially constructed) warehous...
Definition: TheWarehouse.h:208
MeshBase & mesh
BoundaryID _bnd_id
boundary id for the node
Definition: BndNode.h:26
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const std::map< dof_id_type, std::vector< dof_id_type > > _node_to_elem_map
Node to element map. Used for determining vertex vs. non-vertex nodes.
void join(const BoundaryNodeIntegrityCheckThread &)
const TheWarehouse::Query & _query
A warehouse query that we will use to obtain user objects for boundary variable dependency integrity ...
void boundaryIntegrityCheckError(const MooseObject &object, const std::set< MooseVariableFieldBase *> &variables, const BoundaryName &boundary_name)
Compose boundary restricted error message for the provided object, variables, and boundary_name if th...
AttribBoundaries tracks all boundary IDs associated with an object.
Definition: Attributes.h:188
QueryCache clone() const
clone creates and returns an independent copy of the query in its current state.
Definition: TheWarehouse.h:292
const ExecuteMooseObjectWarehouse< AuxKernel > & _nodal_aux
Nodal auxiliary kernels acting on standard field variables.
libMesh::Node * _node
pointer to the node
Definition: BndNode.h:24
query_obj query
tbb::split split
vec_type::const_iterator const_iterator
virtual MooseMesh & mesh() override
QueryCache & condition(Args &&... args)
Adds a new condition to the query.
Definition: TheWarehouse.h:284
BoundaryNodeIntegrityCheckThread(FEProblemBase &fe_problem, const TheWarehouse::Query &query)
const ExecuteMooseObjectWarehouse< VectorAuxKernel > & _nodal_vec_aux
Nodal auxiliary kernels acting on vector field variables.
processor_id_type processor_id() const
virtual void onNode(ConstBndNodeRange::const_iterator &node_it) override
Called for each node.
Result check(std::string requirements, const Registry &capabilities)
Checks if a set of requirements is satisified by the given capability registry.