www.mooseframework.org
NodalNormalsCorner.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "NodalNormalsCorner.h"
16 
17 // MOOSE includes
18 #include "AuxiliarySystem.h"
19 #include "MooseMesh.h"
20 #include "MooseVariable.h"
21 
22 #include "libmesh/numeric_vector.h"
23 
24 Threads::spin_mutex nodal_normals_corner_mutex;
25 
26 template <>
29 {
31  params.addRequiredParam<BoundaryName>(
32  "corner_boundary", "Node set ID which contains the nodes that are in 'corners'.");
33  return params;
34 }
35 
37  : SideUserObject(parameters),
38  _aux(_fe_problem.getAuxiliarySystem()),
39  _corner_boundary_id(_mesh.getBoundaryID(getParam<BoundaryName>("corner_boundary")))
40 {
41 }
42 
43 void
45 {
46  Threads::spin_mutex::scoped_lock lock(nodal_normals_corner_mutex);
47  NumericVector<Number> & sln = _aux.solution();
48 
49  // Get a reference to our BoundaryInfo object
50  BoundaryInfo & boundary_info = _mesh.getMesh().get_boundary_info();
51 
52  for (unsigned int nd = 0; nd < _current_side_elem->n_nodes(); nd++)
53  {
54  const Node * node = _current_side_elem->node_ptr(nd);
55  if (boundary_info.has_boundary_id(node, _corner_boundary_id) &&
56  node->n_dofs(_aux.number(), _fe_problem.getVariable(_tid, "nodal_normal_x").number()) > 0)
57  {
58  dof_id_type dof_x = node->dof_number(
59  _aux.number(), _fe_problem.getVariable(_tid, "nodal_normal_x").number(), 0);
60  dof_id_type dof_y = node->dof_number(
61  _aux.number(), _fe_problem.getVariable(_tid, "nodal_normal_y").number(), 0);
62  dof_id_type dof_z = node->dof_number(
63  _aux.number(), _fe_problem.getVariable(_tid, "nodal_normal_z").number(), 0);
64 
65  // substitute the normal form the face, we are going to have at least one normal every time
66  sln.add(dof_x, _normals[0](0));
67  sln.add(dof_y, _normals[0](1));
68  sln.add(dof_z, _normals[0](2));
69  }
70  }
71 }
72 
73 void
75 {
76  _aux.solution().close();
77 }
78 
79 void
81 {
82  _aux.solution().close();
83 }
84 
85 void
87 {
88 }
InputParameters validParams< SideUserObject >()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Elem *& _current_side_elem
THREAD_ID _tid
Thread ID of this postprocessor.
Definition: UserObject.h:152
BoundaryID _corner_boundary_id
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2408
virtual void execute() override
Execute method.
InputParameters validParams< NodalNormalsCorner >()
virtual NumericVector< Number > & solution() override
virtual unsigned int number()
Gets the number of this system.
Definition: SystemBase.C:604
unsigned int number() const
Get variable number coming from libMesh.
virtual void threadJoin(const UserObject &uo) override
Must override.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
AuxiliarySystem & _aux
MooseMesh & _mesh
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:149
Threads::spin_mutex nodal_normals_corner_mutex
const MooseArray< Point > & _normals
virtual void finalize() override
Finalize.
NodalNormalsCorner(const InputParameters &parameters)
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested variable which may be in any system. ...
Base class for user-specific data.
Definition: UserObject.h:42