https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NearestNodeDistanceAux.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
12#include "NearestNodeLocator.h"
13#include "MooseMesh.h"
14
16
19{
22 "Stores the distance between a block and boundary or between two boundaries.");
23 params.addRequiredParam<BoundaryName>("paired_boundary", "The boundary to find the distance to.");
24 params.set<bool>("use_displaced_mesh") = true;
25 return params;
26}
27
29 : AuxKernel(parameters),
30 _nearest_node(_nodal ? getNearestNodeLocator(parameters.get<BoundaryName>("paired_boundary"),
31 boundaryNames()[0])
32 : getQuadratureNearestNodeLocator(
33 parameters.get<BoundaryName>("paired_boundary"), boundaryNames()[0]))
34{
35 if (boundaryNames().size() > 1)
36 mooseError("NearestNodeDistanceAux can only be used with one boundary at a time!");
37}
38
39Real
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", NearestNodeDistanceAux)
MooseMesh & _mesh
Mesh this kernel is active on.
const Elem *const & _current_elem
Current element (valid only for elemental kernels)
Definition AuxKernel.h:133
const Node *const & _current_node
Current node (valid only for nodal kernels)
Definition AuxKernel.h:143
const bool _nodal
Flag indicating if the AuxKernel is nodal.
Definition AuxKernel.h:116
const unsigned int & _current_side
current side of the current element
Definition AuxKernel.h:135
unsigned int _qp
Quadrature point index.
Definition AuxKernel.h:155
static InputParameters validParams()
Definition AuxKernel.C:27
const std::vector< BoundaryName > & boundaryNames() const
Return the boundary names for this object.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition MooseMesh.C:1649
Computes the distance from a block or boundary to another boundary.
NearestNodeLocator & _nearest_node
static InputParameters validParams()
NearestNodeDistanceAux(const InputParameters &parameters)
virtual Real computeValue() override
Compute and return the value of the aux variable.
Real distance(dof_id_type node_id)
Valid to call this after findNodes() has been called to get the distance to the nearest node.