https://mooseframework.inl.gov
ElementCentroidToSurfaceDistanceAux.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 
12 
13 // Register the new AuxKernel class name
14 registerMooseObject("ShiftedBoundaryMethodApp", ElementCentroidToSurfaceDistanceAux);
15 
18 {
20 
21  params.addRequiredParam<UserObjectName>("distance_to_surface",
22  "UserObject that provides distance calculations.");
23 
24  params.addClassDescription(
25  "Creates a distance field based on the 'distance_to_surface' UserObject.");
26 
27  return params;
28 }
29 
31  const InputParameters & parameters)
32  : AuxKernel(parameters),
33  _distance_to_surface(&getUserObject<ShortestDistanceToSurface>("distance_to_surface"))
34 {
35  // Ensure this kernel is used only on elemental variables
36  if (isNodal())
37  paramError("variable", "This AuxKernel only supports Elemental fields");
38 }
39 
40 // computeValue - Perform distance calculation
41 Real
43 {
44  // distance value calculation
45  const Point & pt = _current_elem->vertex_average();
46 
47  const Point & closest_vec = _distance_to_surface->distanceVector(pt);
48 
49  return closest_vec.norm();
50 }
auto norm() const
void paramError(const std::string &param, Args... args) const
ElementCentroidToSurfaceDistanceAux(const InputParameters &parameters)
registerMooseObject("ShiftedBoundaryMethodApp", ElementCentroidToSurfaceDistanceAux)
void addRequiredParam(const std::string &name, const std::string &doc_string)
User object that computes the shortest distance to one or more surfaces defined by function- and/or m...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
RealVectorValue distanceVector(const Point &pt) const
Return the closest distance vector from point pt to the boundaries.
const ShortestDistanceToSurface * _distance_to_surface
user object for distance and normal calculations