24 "builder",
"SBMSurfaceMeshBuilder that provides the interface surface geometry.");
26 "manager",
"SBMInterfaceManager that provides geometry for multiple interfaces.");
31 "Returns unsigned distance to a surface mesh using k-d tree nearest neighbor search. "
32 "The gradient returns the unit vector pointing from boundary to query point.");
43 if (has_builder == has_manager)
44 paramError(
"builder",
"Specify exactly one of 'builder' and 'manager'.");
45 if (has_manager && (!has_first || !has_second))
46 paramError(
"manager",
"Manager mode requires subdomain_id_1 and subdomain_id_2.");
47 if (!has_manager && (has_first || has_second))
48 paramError(
"subdomain_id_1",
"Subdomain IDs are only valid in manager mode.");
52 getParam<SubdomainID>(
"subdomain_id_2")};
54 paramError(
"subdomain_id_2",
"The interface subdomain IDs must be distinct.");
63 _manager = &getUserObject<SBMInterfaceManager>(
"manager");
65 paramError(
"manager",
"The requested interface was not detected by the manager.");
69 const auto builder = &getUserObject<SBMSurfaceMeshBuilder>(
"builder");
70 if (!builder->hasKDTree())
73 "' requires SBMSurfaceMeshBuilder '",
75 "' to be configured with 'build_kd_tree = true'.");
85 std::vector<std::size_t> ret_index(1);
111 const Real dist = dv.norm();
114 return RealGradient(0, 0, 0);
130 RealVectorValue n = elem.
normal();
131 const Real n_norm = n.norm();
registerMooseObject("ShiftedBoundaryMethodApp", UnsignedDistanceToSurfaceMesh)
static InputParameters validParams()
void neighborSearch(const Point &query_point, unsigned int patch_size, std::vector< std::size_t > &return_index)
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
InterfaceQueryResult queryInterface(SubdomainID first, SubdomainID second, const Point &point) const
Return distance and normal data for an interface. The normal points from first to second.
bool hasInterface(SubdomainID first, SubdomainID second) const
Whether an interface was detected between two subdomains.
const Point & normal() const
Computes the unsigned distance to a surface mesh using geometry supplied by SBMSurfaceMeshBuilder or ...
KDTree * _kd_tree
Cached pointers for per-interface builder mode.
const std::vector< std::unique_ptr< SurfaceElement > > * _boundary_elements
RealVectorValue surfaceNormal(const Point &p) const
Return the true boundary surface normal evaluated at the closest point obtained by projecting the que...
virtual void initialSetup() override
static InputParameters validParams()
std::pair< SubdomainID, SubdomainID > _subdomain_pair
const SBMInterfaceManager * _manager
Optional single-mesh manager used instead of a per-interface builder.
const SurfaceElement & closestBoundaryElem(const Point &p) const
find closest boundary element using k-d tree
Real value(Real t, const Point &p) const override
Return unsigned distance value.
RealGradient gradient(Real t, const Point &p) const override
Return the spatial gradient of the unsigned distance function.
RealVectorValue distanceVectorToSurface(const Point &p) const
find closest boundary element and return its distance vector
UnsignedDistanceToSurfaceMesh(const InputParameters ¶meters)
libMesh::Point distanceFrom(const SurfaceElement &surface_elem, const libMesh::Point &pt)
Returns the vector from pt to the nearest point on the surface element: the normal projection if it f...
static constexpr Real TOLERANCE
RealVectorValue distance
Shortest distance vector to the interface.
RealVectorValue normal
Unit normal vector of the interface (pointing from first to second subdomain)