https://mooseframework.inl.gov
NodalNormalsCorner.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 #include "NodalNormalsCorner.h"
11 
12 // MOOSE includes
13 #include "AuxiliarySystem.h"
14 #include "MooseMesh.h"
15 #include "MooseVariableFE.h"
17 
18 #include "libmesh/numeric_vector.h"
19 
21 
24 {
26  params.addClassDescription("Computes nodal normals at boundary corners.");
27  params.addRequiredParam<BoundaryName>(
28  "corner_boundary", "Node set ID which contains the nodes that are in 'corners'.");
29  return params;
30 }
31 
33  : SideUserObject(parameters),
34  _aux(_fe_problem.getAuxiliarySystem()),
35  _corner_boundary_id(_mesh.getBoundaryID(getParam<BoundaryName>("corner_boundary")))
36 {
37 }
38 
39 void
41 {
44 
45  // Get a reference to our BoundaryInfo object
46  BoundaryInfo & boundary_info = _mesh.getMesh().get_boundary_info();
47 
48  for (unsigned int nd = 0; nd < _current_side_elem->n_nodes(); nd++)
49  {
50  const Node * node = _current_side_elem->node_ptr(nd);
51  if (boundary_info.has_boundary_id(node, _corner_boundary_id) &&
52  node->n_dofs(_aux.number(),
55  "nodal_normal_x",
58  .number()) > 0)
59  {
60  dof_id_type dof_x = node->dof_number(_aux.number(),
63  "nodal_normal_x",
66  .number(),
67  0);
68  dof_id_type dof_y = node->dof_number(_aux.number(),
71  "nodal_normal_y",
74  .number(),
75  0);
76  dof_id_type dof_z = node->dof_number(_aux.number(),
79  "nodal_normal_z",
82  .number(),
83  0);
84 
85  // substitute the normal from the face, we are going to have at least one normal every time
86  sln.add(dof_x, _normals[0](0));
87  sln.add(dof_y, _normals[0](1));
88  sln.add(dof_z, _normals[0](2));
89  }
90  }
91 }
92 
93 void
95 {
96  _aux.solution().close();
97 }
98 
99 void
101 {
102  _aux.solution().close();
103 }
static InputParameters validParams()
static InputParameters validParams()
static std::mutex _nodal_normals_mutex
NumericVector< Number > & solution()
Definition: SystemBase.h:196
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...
Base class for user objects executed one or more sidesets, which may be on the outer boundary of the ...
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...
virtual const MooseVariableFieldBase & getVariable(const 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) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
BoundaryID getBoundaryID(const BoundaryName &boundary_name, const MeshBase &mesh)
Gets the boundary ID associated with the given BoundaryName.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:3448
virtual void execute() override
Execute method.
unsigned int number() const
Gets the number of this system.
Definition: SystemBase.C:1149
registerMooseObject("MooseApp", NodalNormalsCorner)
virtual void close()=0
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:211
const MooseArray< Point > & _normals
const THREAD_ID _tid
Thread ID of this postprocessor.
Definition: UserObject.h:218
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
virtual void add(const numeric_index_type i, const Number value)=0
virtual void finalize() override
Finalize.
NodalNormalsCorner(const InputParameters &parameters)
uint8_t dof_id_type