ParsedSubdomainMeshGenerator

Uses a parsed expression (combinatorial_geometry) to determine if an element (via its centroid) is inside the region defined by the expression and assigns a new block ID.

Example

The desired example mesh is a 1-by-1 2D square which contains Block 1 (a centered 0.8-by-0.8 square) and Block 2 (a 0.4-by-0.4 square located in the bottom left quarter of Block 1). The remaining edge of the square can be Block 0.

The combinatorial expression that defines Block 1 is below.


x > 0.1 & x < 0.9 & y > 0.1 & y < 0.9

The expression


x < 0.5 & y < 0.5

can partially define Block 2, but the region outside Block 1 also needs to be excluded. The input file syntax needed to generate this example is shown below.

[Mesh<<<{"href": "../../syntax/Mesh/index.html"}>>>]
  [gmg]
    type = GeneratedMeshGenerator<<<{"description": "Create a line, square, or cube mesh with uniformly spaced or biased elements.", "href": "GeneratedMeshGenerator.html"}>>>
    dim<<<{"description": "The dimension of the mesh to be generated"}>>> = 2
    nx<<<{"description": "Number of elements in the X direction"}>>> = 10
    ny<<<{"description": "Number of elements in the Y direction"}>>> = 10
    xmax<<<{"description": "Upper X Coordinate of the generated mesh"}>>> = 1
    ymax<<<{"description": "Upper Y Coordinate of the generated mesh"}>>> = 1
  []

  [subdomains]
    type = ParsedSubdomainMeshGenerator<<<{"description": "Uses a parsed expression (`combinatorial_geometry`) to determine if an element (via its centroid) is inside the region defined by the expression and assigns a new block ID.", "href": "ParsedSubdomainMeshGenerator.html"}>>>
    input<<<{"description": "The mesh we want to modify"}>>> = gmg
    combinatorial_geometry<<<{"description": "Function expression encoding a combinatorial geometry"}>>> = 'x > 0.1 & x < 0.9 & y > 0.1 & y < 0.9'
    block_id<<<{"description": "Subdomain id to set for inside of the combinatorial"}>>> = 1
  []

  [subdomains2]
    type = ParsedSubdomainMeshGenerator<<<{"description": "Uses a parsed expression (`combinatorial_geometry`) to determine if an element (via its centroid) is inside the region defined by the expression and assigns a new block ID.", "href": "ParsedSubdomainMeshGenerator.html"}>>>
    combinatorial_geometry<<<{"description": "Function expression encoding a combinatorial geometry"}>>> = 'x < 0.5 & y < 0.5'
    excluded_subdomains<<<{"description": "A set of subdomain names that will not changed even if they are inside/outside the combinatorial geometry"}>>> = '0'
    block_id<<<{"description": "Subdomain id to set for inside of the combinatorial"}>>> = 2
    input<<<{"description": "The mesh we want to modify"}>>> = subdomains
  []
[]
(moose/test/tests/meshgenerators/parsed_subdomain_mesh_generator/parsed_subdomain_mg.i)

The final mesh output is:

Input Parameters

  • block_idSubdomain id to set for inside of the combinatorial

    C++ Type:unsigned short

    Controllable:No

    Description:Subdomain id to set for inside of the combinatorial

  • combinatorial_geometryFunction expression encoding a combinatorial geometry

    C++ Type:std::string

    Controllable:No

    Description:Function expression encoding a combinatorial geometry

  • inputThe mesh we want to modify

    C++ Type:MeshGeneratorName

    Controllable:No

    Description:The mesh we want to modify

Required Parameters

  • block_nameSubdomain name to set for inside of the combinatorial

    C++ Type:SubdomainName

    Controllable:No

    Description:Subdomain name to set for inside of the combinatorial

  • constant_expressionsVector of values for the constants in constant_names (can be an FParser expression)

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Vector of values for the constants in constant_names (can be an FParser expression)

  • constant_namesVector of constants used in the parsed function

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Vector of constants used in the parsed function

  • epsilon0Fuzzy comparison tolerance

    Default:0

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Fuzzy comparison tolerance

  • excluded_subdomainsA set of subdomain names that will not changed even if they are inside/outside the combinatorial geometry

    C++ Type:std::vector<SubdomainName>

    Controllable:No

    Description:A set of subdomain names that will not changed even if they are inside/outside the combinatorial geometry

  • extra_element_id_namesExtra element integers used in the parsed expression

    C++ Type:std::vector<ExtraElementIDName>

    Controllable:No

    Description:Extra element integers used in the parsed expression

Optional Parameters

  • disable_fpoptimizerFalseDisable the function parser algebraic optimizer

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Disable the function parser algebraic optimizer

  • enable_ad_cacheTrueEnable caching of function derivatives for faster startup time

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable caching of function derivatives for faster startup time

  • enable_auto_optimizeTrueEnable automatic immediate optimization of derivatives

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable automatic immediate optimization of derivatives

  • enable_jitTrueEnable just-in-time compilation of function expressions for faster evaluation

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable just-in-time compilation of function expressions for faster evaluation

  • evalerror_behaviornanWhat to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception

    Default:nan

    C++ Type:MooseEnum

    Options:nan, nan_warning, error, exception

    Controllable:No

    Description:What to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception

Parsed Expression Advanced Parameters

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Set the enabled status of the MooseObject.

  • save_with_nameKeep the mesh from this mesh generator in memory with the name specified

    C++ Type:std::string

    Controllable:No

    Description:Keep the mesh from this mesh generator in memory with the name specified

Advanced Parameters

  • nemesisFalseWhether or not to output the mesh file in the nemesisformat (only if output = true)

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether or not to output the mesh file in the nemesisformat (only if output = true)

  • outputFalseWhether or not to output the mesh file after generating the mesh

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether or not to output the mesh file after generating the mesh

  • show_infoFalseWhether or not to show mesh info after generating the mesh (bounding box, element types, sidesets, nodesets, subdomains, etc)

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether or not to show mesh info after generating the mesh (bounding box, element types, sidesets, nodesets, subdomains, etc)

Debugging Parameters