https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
39void
41{
43 NumericVector<Number> & sln = _aux.solution();
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
93void
98
99void
registerMooseObject("MooseApp", NodalNormalsCorner)
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...
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3549
unsigned int number() const
Get variable number coming from libMesh.
static InputParameters validParams()
virtual void finalize() override
Finalize.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual void execute() override
Execute method.
NodalNormalsCorner(const InputParameters &parameters)
AuxiliarySystem & _aux
Base class for user objects executed one or more sidesets, which may be on the outer boundary of the ...
static InputParameters validParams()
MooseMesh & _mesh
const Elem *const & _current_side_elem
const MooseArray< Point > & _normals
unsigned int number() const
Gets the number of this system.
NumericVector< Number > & solution()
Definition SystemBase.h:203
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
const THREAD_ID _tid
Thread ID of this postprocessor.
virtual void close()=0
@ VAR_FIELD_STANDARD
Definition MooseTypes.h:777
@ VAR_AUXILIARY
Definition MooseTypes.h:771