www.mooseframework.org
NodalNormalsCorner.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "NodalNormalsCorner.h"
11 
12 // MOOSE includes
13 #include "AuxiliarySystem.h"
14 #include "MooseMesh.h"
15 #include "MooseVariableFE.h"
16 
17 #include "libmesh/numeric_vector.h"
18 
19 Threads::spin_mutex nodal_normals_corner_mutex;
20 
22 
23 template <>
26 {
28  params.addRequiredParam<BoundaryName>(
29  "corner_boundary", "Node set ID which contains the nodes that are in 'corners'.");
30  return params;
31 }
32 
34  : SideUserObject(parameters),
35  _aux(_fe_problem.getAuxiliarySystem()),
36  _corner_boundary_id(_mesh.getBoundaryID(getParam<BoundaryName>("corner_boundary")))
37 {
38 }
39 
40 void
42 {
43  Threads::spin_mutex::scoped_lock lock(nodal_normals_corner_mutex);
44  NumericVector<Number> & sln = _aux.solution();
45 
46  // Get a reference to our BoundaryInfo object
47  BoundaryInfo & boundary_info = _mesh.getMesh().get_boundary_info();
48 
49  for (unsigned int nd = 0; nd < _current_side_elem->n_nodes(); nd++)
50  {
51  const Node * node = _current_side_elem->node_ptr(nd);
52  if (boundary_info.has_boundary_id(node, _corner_boundary_id) &&
53  node->n_dofs(_aux.number(),
56  "nodal_normal_x",
59  .number()) > 0)
60  {
61  dof_id_type dof_x = node->dof_number(_aux.number(),
64  "nodal_normal_x",
67  .number(),
68  0);
69  dof_id_type dof_y = node->dof_number(_aux.number(),
72  "nodal_normal_y",
75  .number(),
76  0);
77  dof_id_type dof_z = node->dof_number(_aux.number(),
80  "nodal_normal_z",
83  .number(),
84  0);
85 
86  // substitute the normal form the face, we are going to have at least one normal every time
87  sln.add(dof_x, _normals[0](0));
88  sln.add(dof_y, _normals[0](1));
89  sln.add(dof_z, _normals[0](2));
90  }
91  }
92 }
93 
94 void
96 {
97  _aux.solution().close();
98 }
99 
100 void
102 {
103  _aux.solution().close();
104 }
105 
106 void
108 {
109 }
InputParameters validParams< SideUserObject >()
virtual MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
unsigned int number() const
Get variable number coming from libMesh.
const Elem *const & _current_side_elem
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
THREAD_ID _tid
Thread ID of this postprocessor.
Definition: UserObject.h:144
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:2567
virtual void execute() override
Execute method.
NumericVector< Number > & solution() override
virtual unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:926
registerMooseObject("MooseApp", NodalNormalsCorner)
InputParameters validParams< NodalNormalsCorner >()
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:141
Threads::spin_mutex nodal_normals_corner_mutex
const MooseArray< Point > & _normals
virtual void finalize() override
Finalize.
NodalNormalsCorner(const InputParameters &parameters)
Base class for user-specific data.
Definition: UserObject.h:37