4.1.1.7.1.4. pyfem.models.RVE module
- class RVE(props, globdat)[source]
Bases:
BaseModelRepresentative Volume Element (RVE) model for periodic boundary conditions.
This model implements periodic boundary conditions on a rectangular RVE by constraining nodes on opposite boundaries (Left-Right, Top-Bottom) to maintain periodic displacement fields under prescribed macroscopic strain.
- dx
Width of the RVE (x-direction offset).
- Type:
float
- dy
Height of the RVE (y-direction offset).
- Type:
float
- crdsLeft, crdsRight
Coordinates of left and right boundary nodes, sorted by y-coordinate.
- Type:
numpy.ndarray
- crdsTop, crdsBottom
Coordinates of top and bottom boundary nodes, sorted by x-coordinate.
- Type:
numpy.ndarray
- nodesLeft, nodesRight
Node IDs of left and right boundary nodes, sorted by y-coordinate.
- Type:
numpy.ndarray
- nodesTop, nodesBottom
Node IDs of top and bottom boundary nodes, sorted by x-coordinate.
- Type:
numpy.ndarray
- prepare(props, globdat)[source]
Apply periodic boundary constraints based on prescribed macroscopic strain.
This method applies displacement constraints to corner nodes and periodic constraints to boundary nodes to enforce a prescribed macroscopic strain state. The strain vector follows Voigt notation: [ε_xx, ε_yy, γ_xy].
- Parameters:
props (Properties) – Model properties (currently unused).
globdat (GlobalData) – Global data structure containing nodes, elements, and DOFs.
Notes
The method: 1. Defines macroscopic strain components (currently hardcoded). 2. Calculates corner node displacements from strain. 3. Constrains the bottom-left corner node (node 1) to zero displacement. 4. Applies calculated displacements to the three other corner nodes. 5. Applies periodic constraints to all interior boundary nodes.
- commit(props, globdat)[source]
Finalize the current step (placeholder).
This method is called at the end of a load step or increment. It can be used to update state variables, store results, or perform post-processing. Currently, it only prints the internal force vector for debugging purposes.
- Parameters:
props (Properties) – Model properties (currently unused).
globdat (GlobalData) – Global data structure containing nodes, elements, and DOFs.
- getBoundaries(props, globdat)[source]
Extract and validate boundary nodes for periodic RVE constraints.
This method retrieves boundary node coordinates and IDs from node groups (Left, Right, Top, Bottom), sorts them for proper pairing, and validates the RVE geometry to ensure: - Matching numbers of nodes on opposite boundaries. - Proper alignment of node coordinates. - Consistent spacing between paired nodes.
- Parameters:
props (Properties) – Model properties (currently unused).
globdat (GlobalData) – Global data structure containing nodes, elements, and DOFs.
- Raises:
Warning – If boundary nodes don’t match in number, alignment, or spacing.
Notes
Sets the following instance attributes: - crdsLeft, crdsRight: Sorted coordinates of left/right boundaries. - crdsTop, crdsBottom: Sorted coordinates of top/bottom boundaries. - nodesLeft, nodesRight: Sorted node IDs of left/right boundaries. - nodesTop, nodesBottom: Sorted node IDs of top/bottom boundaries. - dx: Width of the RVE. - dy: Height of the RVE.
- applyPeriodicBC(globdat) None[source]
Apply periodic boundary constraints for prescribed macroscopic strain.
Implements periodic boundary conditions by: 1. Fixing the bottom-left corner node (node 1) to zero displacement. 2. Prescribing displacements at the three other corner nodes based on strain. 3. Coupling interior boundary nodes on opposite sides with periodic constraints.
- Parameters:
strain (numpy.ndarray) – Macroscopic strain tensor in Voigt notation [ε_xx, ε_yy, γ_xy]. Components define the prescribed deformation of the RVE.
props (Properties) – Model properties (currently unused).
globdat (GlobalData) – Global data structure containing nodes, elements, and DOFs.
Notes
Corner node displacements are computed from: - u12 (bottom-right): u_x = dx * ε_xx, u_y = 0.5 * dx * γ_xy - u14 (top-left): u_x = 0.5 * dy * γ_xy, u_y = dy * ε_yy - u34 (top-right): u = u12 + u14
Interior nodes are coupled via linear constraints: - Right nodes: u_right = u12 + u_left - Top nodes: u_top = u14 + u_bottom
- applyPrescribedBC(globdat) None[source]
Apply prescribed displacement boundary conditions for uniform strain.
Prescribes displacements at all boundary nodes based on a linear displacement field corresponding to the given macroscopic strain. This approach is simpler than periodic BCs but does not allow periodic fluctuations in the displacement field.
- Parameters:
strain (numpy.ndarray) – Macroscopic strain tensor in Voigt notation [ε_xx, ε_yy, γ_xy].
props (Properties) – Model properties (currently unused).
globdat (GlobalData) – Global data structure containing nodes, elements, and DOFs.
Notes
For each boundary node at position (x, y), the prescribed displacements are: - u_x = ε_xx * x + 0.5 * γ_xy * y - u_y = ε_yy * y + 0.5 * γ_xy * x
All boundary nodes (Left, Right, Top, Bottom) are collected and constrained, with corner nodes appearing only once due to the use of np.unique().