RVE Interface
fiber_matrix.rve.FiberRVE
A class that defines a fiber/matrix RVE.
This facade coordinates the placement of fibers, boundary definitions, and meshing/visualization.
boundary_points
property
Returns the vertices of the RVE boundary in order.
create_3d_mesh(mesh_name='FiberMatrixRVE3D', thickness=1.0, mesh_size_factor=1.0, z_layers=4, visualize_gui=False, check_periodicity=False, periodic_z=False, surface_groups=False, composite_surface_groups=False, anchor_node_groups=False, uniform_mesh=True, fiber_mesh_size=None, matrix_mesh_size=None, boundary_mesh_size=None, interface_refinement_distance=None, boundary_refinement_distance=None, recombine_prisms=False)
Generates a 3D volume mesh for the current RVE configuration using GMSH.
The 3D mesh is created by extruding the fragmented 2D fiber/matrix
geometry through thickness. Periodic 2D boundary pairs become
periodic side-surface pairs in the 3D mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_name
|
str
|
Base name for output files (.msh, .vtk). Default "FiberMatrixRVE3D". |
'FiberMatrixRVE3D'
|
thickness
|
float
|
Extrusion thickness in the positive z direction. Default 1.0. |
1.0
|
mesh_size_factor
|
float
|
Global scaling factor for mesh element size. Default 1.0. |
1.0
|
z_layers
|
int
|
Number of mesh layers through the thickness. Default 4. |
4
|
visualize_gui
|
bool
|
If True, opens the GMSH GUI to visualize mesh generation steps. Default False. |
False
|
check_periodicity
|
bool
|
If True, asserts that generated mesh nodes on periodic surfaces match. Default False. |
False
|
periodic_z
|
bool
|
If True, also makes the top and bottom surfaces periodic. Default False. |
False
|
surface_groups
|
bool
|
If True, creates material-specific physical surface groups for left, right, bottom, top, front, and back. Default False. |
False
|
composite_surface_groups
|
bool
|
If True, creates whole-composite physical surface groups for left, right, bottom, top, front, and back. Default False. |
False
|
anchor_node_groups
|
bool
|
If True, creates 0D physical groups named anchor_xyz, anchor_yz, and anchor_z for mechanical constraint boundary conditions. Default False. |
False
|
uniform_mesh
|
bool
|
If True, uses mesh_size_factor as a global mesh size. If False, applies separate mesh sizes for fiber, matrix, and exterior boundary regions. Default True. |
True
|
fiber_mesh_size
|
float
|
Target element size on fiber surfaces for non-uniform meshes. |
None
|
matrix_mesh_size
|
float
|
Target element size on matrix surfaces for non-uniform meshes. |
None
|
boundary_mesh_size
|
float
|
Target element size on exterior domain boundaries for non-uniform meshes. |
None
|
interface_refinement_distance
|
float
|
Distance away from fiber/matrix interfaces over which the mesh transitions from fiber_mesh_size to matrix_mesh_size. Used only when uniform_mesh is False. |
None
|
boundary_refinement_distance
|
float
|
Distance away from exterior domain boundaries over which the mesh transitions from boundary_mesh_size to matrix_mesh_size. Used only when uniform_mesh is False. |
None
|
recombine_prisms
|
bool
|
If True, recombines the structured extrusion into prism/wedge elements instead of subdividing into tetrahedra. This can reduce radial-looking tetrahedral subdivision patterns. Default False. |
False
|
create_mesh(mesh_name='FiberMatrixRVE', mesh_size_factor=1.0, visualize_gui=False, check_periodicity=False)
Generates a mesh for the current RVE configuration using GMSH.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh_name
|
str
|
Base name for output files (.msh, .vtk). Default "FiberMatrixRVE". |
'FiberMatrixRVE'
|
mesh_size_factor
|
float
|
Global scaling factor for mesh element size. Default 1.0. |
1.0
|
visualize_gui
|
bool
|
If True, opens the GMSH GUI to visualize mesh generation steps. Default False. |
False
|
check_periodicity
|
bool
|
If True, asserts that the generated mesh nodes on periodic boundaries match. Default False. |
False
|
draw(fig=None, ax=None, frame=None, label_fibers=False, label_boundaries=False)
Draws the current state of the RVE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
Matplotlib figure. |
None
|
ax
|
Axes
|
Matplotlib axes. |
None
|
frame
|
int
|
Frame number for saving animation sequences. |
None
|
label_fibers
|
bool
|
Label fibers with indices. |
False
|
label_boundaries
|
bool
|
Label boundaries with indices. |
False
|
get_fiber_centers()
Returns the current centers of all primary fibers.
Returns:
| Type | Description |
|---|---|
List[ndarray]
|
List of fiber center coordinates. |
initialize_hexagonal_rve(num_fibers, vf=0.6, avg_diam=5e-06, diam_std_dev=0.0, boundary_type=BoundaryType.PERIODIC)
Calculates dimensions and initializes a regular hexagonal RVE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_fibers
|
int
|
Target number of fibers. |
required |
vf
|
float
|
Target fiber volume fraction. Default 0.6. |
0.6
|
avg_diam
|
float
|
Average fiber diameter. Default 5e-6. |
5e-06
|
diam_std_dev
|
float
|
Standard deviation of fiber diameter. Default 0.0. |
0.0
|
boundary_type
|
BoundaryType
|
Type of boundary to apply to all edges. Default PERIODIC. |
PERIODIC
|
Returns:
| Type | Description |
|---|---|
List[float]
|
The side length of the hexagon [side_length]. |
initialize_rectangle_rve(num_fibers, vf=0.6, avg_diam=5e-06, diam_std_dev=0.0, rve_aspect_ratio=1.0, fixed_height=None, boundary_type=BoundaryType.PERIODIC)
Calculates dimensions of the RVE and generates fiber radii distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_fibers
|
int
|
Target number of fibers. |
required |
vf
|
float
|
Target fiber volume fraction. Default 0.6. |
0.6
|
avg_diam
|
float
|
Average fiber diameter. Default 5e-6. |
5e-06
|
diam_std_dev
|
float
|
Standard deviation of fiber diameter relative to average (scale factor). Default 0.0. |
0.0
|
rve_aspect_ratio
|
float
|
Ratio of width to height (w/h). Default 1.0. |
1.0
|
fixed_height
|
float
|
If provided, fixes RVE height and calculates width to satisfy VF. |
None
|
Returns:
| Type | Description |
|---|---|
List[float]
|
The calculated RVE dimensions [width, height]. |
is_inside_rve(point)
Checks if a point is strictly inside the RVE boundaries.
place_initial_fibers(specified_fiber_centers=None, plot_triangulation=False)
Places fibers within the RVE domain, using triangulation for random placement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specified_fiber_centers
|
List[List[float]]
|
List of [x, y] coordinates to force fiber locations. |
None
|
plot_triangulation
|
bool
|
If True and matplotlib is available, plots the RVE triangulation. |
False
|
Returns:
| Type | Description |
|---|---|
Tuple[float, float]
|
Actual Fiber Volume Fraction (VF) and Total RVE Area. |
solve_fiber_locations(min_spacing_ratio, visualization_path=None, show_final=False, iterations_max=100)
Executes the solver to resolve fiber overlaps and enforce spacing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_spacing_ratio
|
float
|
Minimum separation between fibers as a ratio of the average diameter. |
required |
visualization_path
|
Optional[str]
|
If provided, saves an animation of the solution process to the given path. Default None. |
None
|
show_final
|
bool
|
If True, displays the final RVE plot to screen. Default False. |
False
|