22 "Parsed function expression (in terms of x, y, and z) "
23 "defining the signed distance function to "
27 "subdomain_id_inside",
"Subdomain ID to assign to elements categorized inside the domain.");
29 "subdomain_id_outside",
"Subdomain ID to assign to elements categorized outside the domain.");
32 "threshold", 0.0,
"Level-set threshold value defining the interface boundary (default 0.0).");
34 "is_domain_inside_surface",
35 "Whether the inside domain corresponds to the negative signed distance region (< threshold). "
36 "If true, points with signed distance < threshold are categorized as inside and > threshold "
37 "as outside. If false, points with signed distance > threshold are categorized as inside.");
41 "Whether to enable multi-geometry handling when chaining generators, allowing elements with "
42 "specific existing subdomain IDs to be preserved without reclassification (see "
43 "'keep_inside_as_inside' and 'keep_outside_as_outside').");
44 params.
addParam<
bool>(
"keep_inside_as_inside",
46 "When 'multi_geo' is true, elements whose existing subdomain ID matches "
47 "'subdomain_id_inside' "
48 "are skipped, preserving their existing subdomain assignment.");
50 "keep_outside_as_outside",
52 "When 'multi_geo' is true, elements whose existing subdomain ID matches "
53 "'subdomain_id_outside' are skipped, preserving their existing subdomain assignment.");
56 "modify_outside_only",
58 "If true, only elements categorized as outside are updated to 'subdomain_id_outside'; "
59 "elements categorized as inside retain their existing subdomain IDs.");
63 "If true, only elements categorized as inside are updated to 'subdomain_id_inside'; elements "
64 "categorized as outside retain their existing subdomain IDs.");
67 "intercepted subdomains based on an analytical signed distance "
68 "function expression.");
77 _subdomain_id_inside(getParam<
SubdomainID>(
"subdomain_id_inside")),
78 _subdomain_id_outside(getParam<
SubdomainID>(
"subdomain_id_outside")),
79 _threshold(getParam<Real>(
"threshold")),
80 _is_domain_inside_surface(getParam<bool>(
"is_domain_inside_surface")),
81 _multi_geo(getParam<bool>(
"multi_geo")),
82 _keep_inside_as_inside(getParam<bool>(
"keep_inside_as_inside")),
83 _keep_outside_as_outside(getParam<bool>(
"keep_outside_as_outside")),
84 _modify_outside_only(getParam<bool>(
"modify_outside_only")),
85 _modify_inside_only(getParam<bool>(
"modify_inside_only"))
89 if (
_parsed_function->Parse(getParam<std::string>(
"signed_dist_function"),
"x,y,z") >= 0)
90 mooseError(
"Invalid function expression provided.");
95std::unique_ptr<libMesh::MeshBase>
99 std::unique_ptr<libMesh::MeshBase>
mesh = std::move(
_input);
101 for (
const auto & elem :
mesh->active_element_ptr_range() )
116 const auto is_in_domain = [&](
const Point & point)
124 const auto is_outside_domain = [&](
const Point & point)
134 const auto occupancy =
147 mesh->unset_is_prepared();
registerMooseObject("ShiftedBoundaryMethodApp", SubdomainInterceptedGenerator)
std::vector< GenericReal< is_ad > > _func_params
void setParserFeatureFlags(SymFunctionPtr &) const
GenericReal< is_ad > evaluate(SymFunctionPtr &, const std::string &object_name="")
static InputParameters validParams()
GenericSymFunction< is_ad > SymFunction
void mooseError(Args &&... args) const
const SBMUtils::InterceptedSubdomainPolicy _intercepted_subdomain_policy
Policy for assigning partial elements to a dedicated intercepted subdomain.
const Order _qrule_order
Quadrature order used to estimate the retained-domain fraction.
const Real _lambda
Threshold applied to the fraction outside the retained domain for a partial element.
Common parameters and members for shifted boundary subdomain mesh generators that classify volume ele...
std::unique_ptr< libMesh::MeshBase > & _input
The input mesh to modify.
static InputParameters validParams()
Classifies mesh elements into inside, outside, and optionally intercepted subdomains based on an anal...
SubdomainInterceptedGenerator(const InputParameters ¶meters)
SubdomainID _subdomain_id_inside
Subdomain ID assigned to elements categorized inside the domain.
SymFunctionPtr _parsed_function
Parsed function.
bool _modify_inside_only
If true, only modify inside elements; outside elements retain their existing subdomain IDs.
bool _multi_geo
Whether multi-geometry handling is enabled to skip previously assigned elements.
bool _keep_outside_as_outside
If multi_geo is true, whether to keep elements already matching subdomain_id_outside.
bool _modify_outside_only
If true, only modify outside elements; inside elements retain their existing subdomain IDs.
static InputParameters validParams()
bool _is_domain_inside_surface
Whether the inside domain corresponds to the negative signed distance region (< threshold)
SubdomainID _subdomain_id_outside
Subdomain ID assigned to elements categorized outside the domain.
bool _keep_inside_as_inside
If multi_geo is true, whether to keep elements already matching subdomain_id_inside.
std::unique_ptr< libMesh::MeshBase > generate() override
Real _threshold
Level-set threshold value defining the interface boundary.
ElementDomainOccupancy elementDomainOccupancy(const Elem &elem, Order qrule_order, const std::function< bool(const libMesh::Point &)> &is_in_domain)
Test an element against the domain defined by is_in_domain.
SubdomainID classifySubdomainFromOccupancy(const ElementDomainOccupancy &occupancy, const ClassificationSubdomains &subdomain_id_settings, bool mark_intercepted, Real lambda)
Classify an element from its retained-domain occupancy measurements.
The subdomain IDs a (possibly partial) element can be labeled with.