- boundary_meshThe boundary mesh to use for identifying grain IDs
C++ Type:MeshGeneratorName
Controllable:No
Description:The boundary mesh to use for identifying grain IDs
- inputThe mesh to modify
C++ Type:MeshGeneratorName
Controllable:No
Description:The mesh to modify
SubdomainGrainIDGenerator
Based on the boundary_mesh, which contains distinct grain boundaries as separate watertight regions, this generator assigns grain IDs (subdomain IDs) to the volume mesh. Even if the mesh does not perfectly align with the grain boundaries, each element is assigned the selected grain ID, or retains its input subdomain ID when no grain is selected.
The SubdomainGrainIDGenerator assigns volume-mesh subdomain IDs from the closed regions in a saved boundary mesh. For elements cut by one or more grain regions, the selected intercepted_subdomain_policy determines which grain ID is assigned. Elements that are not within any grain retain their input subdomain ID.
Performance and Acceleration
The SubdomainGrainIDGenerator uses ray casting to determine whether an element lies inside a grain region. To accelerate these containment queries, an internal k-d tree indexes the boundary-element centroids, significantly reducing the number of candidate boundary elements tested for intersection.
Tuning leaf_max_size
The "leaf_max_size" parameter controls the maximum number of boundary-element centroids stored in each leaf node of the k-d tree: - Smaller values**: Create a deeper tree with fewer centroids per leaf, which can speed up ray-intersection queries on very fine boundary meshes at the cost of higher tree-build time and memory. - Larger values**: Create a shallower tree with more centroids per leaf, reducing tree construction overhead and memory footprint at the cost of more linear intersection checks per leaf. - Default (10): A balanced starting point recommended for most meshes unless performance profiling indicates otherwise.
This parameter is purely a performance tuning parameter; tuning its value will not alter the grain geometry or final subdomain assignments.
For lower-level algorithmic details, see AdaptiveRayContainmentCheck.
Example Input File Syntax
The following example demonstrates using SubdomainGrainIDGenerator to assign grain subdomain IDs to a generated background mesh based on closed grain boundaries provided by an external boundary mesh:
[boundary_mesh]
type = FileMeshGenerator
file = 'grain_boundary_only.msh'
[]
[gen]
type = GeneratedMeshGenerator
dim = 2
xmin = -0.6
xmax = 0.6
ymin = -0.4
ymax = 0.4
nx = ${nx}
ny = ${ny}
[]
[grain_gen]
type = SubdomainGrainIDGenerator
input = gen
boundary_mesh = boundary_mesh
lambda = 1
[](modules/shifted_boundary_method/test/tests/grain_boundary_case/grain_boundary_sczm_separate_interfaces.i)Input Parameters
- eps1e-06Tolerance value used for intersection or surface proximity checks. This parameter determines whether a point is considered on the geometry or on the in/out sides of the geometry.
Default:1e-06
C++ Type:Real
Unit:(no unit assumed)
Controllable:No
Description:Tolerance value used for intersection or surface proximity checks. This parameter determines whether a point is considered on the geometry or on the in/out sides of the geometry.
- lambda0.5Threshold applied to the fraction outside the retained domain for a partial element. This parameter cannot be set when 'mark_intercepted' is true.
Default:0.5
C++ Type:Real
Unit:(no unit assumed)
Range:lambda >= 0 & lambda <= 1
Controllable:No
Description:Threshold applied to the fraction outside the retained domain for a partial element. This parameter cannot be set when 'mark_intercepted' is true.
- leaf_max_size10Maximum number of boundary-element centroids per leaf node in the k-d tree used to accelerate ray-casting point-in-grain checks. Tuning this parameter only affects search performance, not the assigned subdomain IDs.
Default:10
C++ Type:unsigned int
Range:leaf_max_size > 0
Controllable:No
Description:Maximum number of boundary-element centroids per leaf node in the k-d tree used to accelerate ray-casting point-in-grain checks. Tuning this parameter only affects search performance, not the assigned subdomain IDs.
- mark_interceptedFalseWhether to assign a dedicated subdomain ID when intercepted.
Default:False
C++ Type:bool
Controllable:No
Description:Whether to assign a dedicated subdomain ID when intercepted.
- qrule_order9Quadrature order used to estimate the retained-domain fraction.
Default:9
C++ Type:int
Range:qrule_order >= 0 & qrule_order <= 10
Controllable:No
Description:Quadrature order used to estimate the retained-domain fraction.
- ray_direction0 0 0The direction of the ray for in-out testing.
Default:0 0 0
C++ Type:libMesh::Point
Controllable:No
Description:The direction of the ray for in-out testing.
- subdomain_id_intercepted65535Subdomain ID assigned to intercepted elements.
Default:65535
C++ Type:unsigned short
Controllable:No
Description:Subdomain ID assigned to intercepted elements.
Optional 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)