Go to the documentation of this file.
15 #include "libmesh/fparser_ad.hh"
16 #include "libmesh/elem.h"
17 #include "libmesh/fe_base.h"
31 "Function expression encoding a combinatorial geometry");
32 params.
addRequiredParam<BoundaryName>(
"new_sideset_name",
"The name of the new sideset");
33 params.
addParam<std::vector<SubdomainID>>(
34 "included_subdomain_ids",
35 "A set of subdomain ids whose sides will be included in the new sidesets");
39 "If provided specifies the normal vector on sides that are added to the new ");
40 params.
addParam<std::vector<std::string>>(
41 "constant_names",
"Vector of constants used in the parsed function (use this for kB etc.)");
42 params.
addParam<std::vector<std::string>>(
43 "constant_expressions",
44 "Vector of values for the constants in constant_names (can be an FParser expression)");
46 "centroid satisfies the combinatorial_geometry expression, (and "
48 "if one of the side's elements is in included_subdomain_ids and if it "
49 "features the correct normal.");
56 _function(parameters.get<
std::string>(
"combinatorial_geometry")),
57 _sideset_name(getParam<BoundaryName>(
"new_sideset_name")),
58 _check_subdomains(isParamValid(
"included_subdomain_ids")),
59 _check_normal(parameters.isParamSetByUser(
"normal")),
60 _included_ids(_check_subdomains
61 ? parameters.get<
std::vector<
SubdomainID>>(
"included_subdomain_ids")
63 _normal(getParam<Point>(
"normal"))
66 _func_F = std::make_shared<ADFunction>();
73 getParam<std::vector<std::string>>(
"constant_names"),
74 getParam<std::vector<std::string>>(
"constant_expressions"));
80 "\nin ParsedAddSideset ",
99 BoundaryInfo & boundary_info = mesh.get_boundary_info();
103 mooseAssert(boundary_ids.size() == 1,
"Length of boundary_ids should be one");
105 for (
const auto & elem : mesh.active_element_ptr_range())
115 for (
unsigned int side = 0; side < elem->n_sides(); ++side)
118 const std::vector<Point> & normals =
_fe_face->get_normals();
125 std::unique_ptr<Elem> curr_side = elem->side_ptr(side);
130 boundary_info.add_side(elem, side, boundary_ids[0]);
void finalize()
This method finalizes the object, setting names back in the boundary_info object and releasing memory...
registerMooseObjectReplaced("MooseApp", ParsedAddSideset, "11/30/2019 00:00", ParsedGenerateSideset)
bool _check_subdomains
whether to check subdomain ids when adding sides or not
void mooseError(Args &&... args) const
MeshGenerator for defining a Sideset by a parsed expression and optionally by looking at the subdomai...
InputParameters validParams< ParsedAddSideset >()
ParsedAddSideset(const InputParameters ¶meters)
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
void setup()
This method is used to construct the FE object so we can compute normals of faces.
bool _check_normal
whether to check normals when adding sides or not
std::vector< SubdomainID > _included_ids
A list of included subdomain ids that the side has to be part of.
std::vector< Real > _func_params
Array to stage the parameters passed to the functions when calling Eval.
InputParameters validParams< AddSideSetsBase >()
Point _normal
A normal vector that (if provided) is compared against side's normals.
std::string _function
function expression
void addFParserConstants(ADFunctionPtr &parser, const std::vector< std::string > &constant_names, const std::vector< std::string > &constant_expressions)
add constants (which can be complex expressions) to the parser object
MooseMesh * _mesh_ptr
Pointer to the mesh.
virtual void modify() override
Pure virtual modify function MUST be overridden by children classes.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
MeshModifier for defining a Sideset by a parsed expression and optionally by looking at the subdomain...
BoundaryName _sideset_name
name of the new sideset
subdomain_id_type SubdomainID
ADFunctionPtr _func_F
function parser object describing the combinatorial geometry
InputParameters validParams< FunctionParserUtils >()
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
Returns a vector of boundary IDs for the requested element on the requested side.
Real evaluate(ADFunctionPtr &)
Evaluate FParser object and check EvalError.
std::unique_ptr< FEBase > _fe_face
virtual const std::string & name() const
Get the name of the object.
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
void setParserFeatureFlags(ADFunctionPtr &)
apply input paramters to internal feature flags of the parser object