23 params.
addClassDescription(
"Marks elements as inside, outside, or intercepted based on a given "
24 "distance function or geometry.");
27 "signed_dist_function",
28 "Signed distance function to evaluate. Exactly one of 'signed_dist_function' and "
29 "'in_out_test' must be provided; providing neither or both is invalid.");
34 params.
addParam<Real>(
"threshold", 0,
"Threshold for inside/outside classification.");
36 "is_domain_inside_surface",
37 "When true, the retained (inside) domain is the region enclosed by the surface (signed "
38 "distance below 'threshold', or points reported inside by the in-out test); when false, the "
39 "retained domain is the region outside the surface.");
43 "The name of the in-out test user object. Exactly one of 'in_out_test' and "
44 "'signed_dist_function' must be provided; providing neither or both is invalid.");
51 _parsed_function(isParamSetByUser(
"signed_dist_function")
52 ? &getFunctionByName(parameters.get<FunctionName>(
"signed_dist_function"))
54 _subdomain_id_inside(getParam<
SubdomainID>(
"subdomain_id_inside")),
55 _subdomain_id_outside(getParam<
SubdomainID>(
"subdomain_id_outside")),
56 _threshold(getParam<Real>(
"threshold")),
57 _is_domain_inside_surface(getParam<bool>(
"is_domain_inside_surface")),
58 _in_out_test_base(nullptr)
62 _depend_uo.insert(getParam<UserObjectName>(
"in_out_test"));
76 ") does not implement the point-in-surface check interface.");
94 mooseError(
"InterceptedElementModifier: provide exactly one geometry source, but both "
95 "'signed_dist_function' and 'in_out_test' were set.");
102 mooseError(
"InterceptedElementModifier: provide exactly one geometry source, but neither "
103 "'signed_dist_function' nor 'in_out_test' was set.");
111 mooseError(
"InterceptedElementModifier: _current_elem is null!");
113 const auto classify_element = [
this](
const bool all_nodes_active,
114 const bool all_nodes_inactive,
127 Real min_val = std::numeric_limits<Real>::max();
128 Real max_val = std::numeric_limits<Real>::lowest();
130 for (
const auto node : make_range(elem->n_nodes()))
133 min_val = std::min(min_val, val);
134 max_val = std::max(max_val, val);
143 const auto is_active = [
this](
const Point & point)
152 return classify_element(all_nodes_active, all_nodes_inactive, ratio_active);
157 unsigned int inside_nodes = 0;
158 for (
const auto node : make_range(elem->n_nodes()))
162 const unsigned int active_nodes =
165 const auto is_active = [
this](
const Point & point)
173 return classify_element(active_nodes == elem->n_nodes(), active_nodes == 0, ratio_active);
177 mooseError(
"InterceptedElementModifier: DistanceType::NONE is invalid in "
178 "computeSubdomainID().");
181 mooseError(
"InterceptedElementModifier: unhandled DistanceType in computeSubdomainID().");
subdomain_id_type SubdomainID
registerMooseObject("ShiftedBoundaryMethodApp", InterceptedElementModifier)
void initialSetup() override
const Elem *const & _current_elem
virtual Real value(Real t, const Point &p) const
DistanceType _in_out_test_type
How to classify the element to be inside or outside.
static InputParameters validParams()
const PointInSurfaceCheckInterface * _in_out_test_base
user object for in-out test
virtual void initialSetup() override
Validate that exactly one geometry source (signed_dist_function or in_out_test) is set,...
SubdomainID _subdomain_id_outside
IDs for subdomain classification (outside)
const PointInSurfaceCheckInterface * getCheckedInOutTest()
Fetches the "in_out_test" user object and validates it implements the point-in-surface check interfac...
InterceptedElementModifier(const InputParameters ¶meters)
const Function * _parsed_function
Store the parsed function.
SubdomainID _subdomain_id_inside
IDs for subdomain classification (inside)
Real _threshold
Threshold value for classification.
virtual SubdomainID computeSubdomainID() override
bool _is_domain_inside_surface
When true, the retained (inside) domain is the region enclosed by the surface (signed distance below ...
const std::string & type() const
const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
bool isParamSetByUser(const std::string &name) const
void mooseError(Args &&... args) const
bool contains(const libMesh::Point &p) const
Common partial-element classification parameters for shifted boundary element modifiers.
const Order _qrule_order
Quadrature order used to estimate the active fraction.
static InputParameters validParams()
const Real _lambda
Threshold applied to the inactive fraction of a partially active element.
const SubdomainID _subdomain_id_intercepted
Subdomain ID assigned to intercepted elements.
const bool _mark_intercepted
Whether to assign a dedicated subdomain ID to intercepted elements.
std::set< std::string > _depend_uo
const UserObjectBase & getUserObjectBase(const std::string ¶m_name, bool is_dependency=true) const
Real activeElementFraction(const Elem &elem, Order qrule_order, const std::function< bool(const libMesh::Point &)> &is_active)
Compute the fraction of an element's quadrature-weighted measure satisfying a predicate.
SubdomainID classifyPartialElement(const ElementActivity &activity, const ClassificationSubdomains &subdomains, bool mark_intercepted, Real lambda)
Classify a (possibly partial) element into an inside/outside/intercepted subdomain.
The subdomain IDs a (possibly partial) element can be labeled with.
Measured activity state of a (possibly partial) element, used to classify it.