https://mooseframework.inl.gov
ShortestDistanceToSurface.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 
11 #include "SBMUtils.h"
12 
13 registerMooseObject("ShiftedBoundaryMethodApp", ShortestDistanceToSurface);
14 
17 {
19  params.addRequiredParam<std::vector<FunctionName>>(
20  "surfaces",
21  "Functions defining the surfaces to measure distance to; each must be a ParsedFunction "
22  "level set or an UnsignedDistanceToSurfaceMesh.");
23  params.addClassDescription(
24  "Computes the shortest distance vector and true normal to one or more surfaces defined by "
25  "parsed level-set functions and/or mesh-based distance functions.");
26  return params;
27 }
28 
30  : ThreadedGeneralUserObject(parameters)
31 {
32  const auto function_names = getParam<std::vector<FunctionName>>("surfaces");
34 }
35 
38 {
40 }
41 
44 {
46 }
47 
49 ShortestDistanceToSurface::distanceVectorByIndex(unsigned int idx, const Point & pt) const
50 {
51  const auto & func = _distance_functions.at(idx);
52  return SBMUtils::distanceVectorFromFunction(func, pt, _t);
53 }
54 
56 ShortestDistanceToSurface::trueNormalByIndex(unsigned int idx, const Point & pt) const
57 {
58  const auto & func = _distance_functions.at(idx);
59  return SBMUtils::trueNormalFromFunction(func, pt, _t);
60 }
61 
64  Real t,
65  const Function * func) const
66 {
67  return SBMUtils::distanceVectorFromFunction(func, pt, t);
68 }
69 
71 ShortestDistanceToSurface::trueNormalByFunc(const Point & pt, Real t, const Function * func) const
72 {
73  return SBMUtils::trueNormalFromFunction(func, pt, t);
74 }
RealVectorValue trueNormalByFunc(const Point &pt, Real t, const Function *func) const
Compute true normal using a specific distance function.
RealVectorValue distanceVectorFromFunction(const Function *func, const libMesh::Point &pt, Real t)
Compute the distance vector induced by a distance function.
Definition: SBMUtils.C:56
RealVectorValue trueNormalFromFunction(const Function *func, const libMesh::Point &pt, Real t)
Compute the true boundary surface normal using a distance function.
Definition: SBMUtils.C:75
registerMooseObject("ShiftedBoundaryMethodApp", ShortestDistanceToSurface)
RealVectorValue closestDistanceVector(const std::vector< const Function *> &funcs, const libMesh::Point &pt, Real t)
Scan all distance functions and return the closest distance vector.
Definition: SBMUtils.C:95
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< const Function * > _distance_functions
Optional signed-distance function.
User object that computes the shortest distance to one or more surfaces defined by function- and/or m...
RealVectorValue distanceVectorByIndex(unsigned int idx, const Point &pt) const
A distance vector from a point pt to a specific surface specified by index idx in the &#39;surfaces&#39; para...
RealVectorValue trueNormal(const Point &pt) const
Return the true normal vector at the closest point on the boundaries.
RealVectorValue closestTrueNormalVector(const std::vector< const Function *> &funcs, const libMesh::Point &pt, Real t)
Scan all distance functions and return the corresponding normal vector.
Definition: SBMUtils.C:117
static InputParameters validParams()
RealVectorValue distanceVectorByFunc(const Point &pt, Real t, const Function *func) const
Compute distance vector using a specific distance function.
RealVectorValue trueNormalByIndex(unsigned int idx, const Point &pt) const
A true normal vector at the projected point of pt onto a specific surface specified by index idx in t...
ShortestDistanceToSurface(const InputParameters &parameters)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
std::vector< const Function * > buildDistanceFunctions(const std::vector< FunctionName > &function_names, const FunctionInterface &function_provider)
Build a list of distance functions based on names specified in input.
Definition: SBMUtils.C:33
RealVectorValue distanceVector(const Point &pt) const
Return the closest distance vector from point pt to the boundaries.
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)