Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
15 #include "libmesh/fparser_ad.hh"
16 #include "libmesh/elem.h"
28 params.
addRequiredParam<MeshGeneratorName>(
"input",
"The mesh we want to modify");
30 "Function expression encoding a combinatorial geometry");
32 "Subdomain id to set for inside of the combinatorial");
33 params.
addParam<SubdomainName>(
"block_name",
34 "Subdomain name to set for inside of the combinatorial");
35 params.
addParam<std::vector<subdomain_id_type>>(
36 "excluded_subdomain_ids",
37 "A set of subdomain ids that will not changed even if "
38 "they are inside/outside the combinatorial geometry");
39 params.
addParam<std::vector<std::string>>(
40 "constant_names",
"Vector of constants used in the parsed function (use this for kB etc.)");
41 params.
addParam<std::vector<std::string>>(
42 "constant_expressions",
43 "Vector of values for the constants in constant_names (can be an FParser expression)");
44 params.
addClassDescription(
"MeshModifier that uses a parsed expression (combinatorial_geometry) "
45 "to determine if an element (aka its centroid) is inside the "
46 "combinatorial geometry and "
47 "assigns a new block id.");
55 _input(getMesh(
"input")),
56 _function(parameters.get<
std::string>(
"combinatorial_geometry")),
58 _excluded_ids(parameters.get<
std::vector<
SubdomainID>>(
"excluded_subdomain_ids"))
61 _func_F = std::make_shared<ADFunction>();
68 getParam<std::vector<std::string>>(
"constant_names"),
69 getParam<std::vector<std::string>>(
"constant_expressions"));
75 "\nin ParsedSubdomainMeshModifier ",
83 std::unique_ptr<MeshBase>
86 std::unique_ptr<MeshBase> mesh = std::move(
_input);
89 for (
const auto & elem : mesh->active_element_ptr_range())
103 mesh->subdomain_name(
_block_id) = getParam<SubdomainName>(
"block_name");
105 return dynamic_pointer_cast<MeshBase>(mesh);
defineLegacyParams(ParsedSubdomainMeshGenerator)
void mooseError(Args &&... args) const
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
const std::string _function
function expression
MeshGenerators are objects that can modify or add to an existing mesh.
registerMooseObject("MooseApp", ParsedSubdomainMeshGenerator)
std::vector< Real > _func_params
Array to stage the parameters passed to the functions when calling Eval.
ParsedSubdomainMeshGenerator(const InputParameters ¶meters)
ADFunctionPtr _func_F
function parser object describing the combinatorial geometry
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
static InputParameters validParams()
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.
std::unique_ptr< MeshBase > & _input
static InputParameters validParams()
subdomain_id_type SubdomainID
const subdomain_id_type _block_id
Block ID to assign to the region.
static InputParameters validParams()
Constructor.
const std::vector< subdomain_id_type > _excluded_ids
A list of excluded subdomain ids that will not be changed even if they are in the combinatorial geome...
Real evaluate(ADFunctionPtr &)
Evaluate FParser object and check EvalError.
MeshGenerator for defining a Subdomain inside or outside of combinatorial geometry.
virtual const std::string & name() const
Get the name of the object.
void setParserFeatureFlags(ADFunctionPtr &)
apply input paramters to internal feature flags of the parser object