FiberSection
FiberSection
FiberSection(user_name: str = 'Unnamed', GJ: Optional[float] = None, components: Optional[List[Union[FiberElement, PatchBase, LayerBase]]] = None)
Bases: Section
General cross-section discretized into a collection of fibers.
The Fiber section is the most general section type in Femora. It allows modeling arbitrary geometries by defining individual fibers, patches (grids), or layers (lines/arcs) of uniaxial materials. The section response is obtained by integrating the response of each fiber over the area.
Tcl form
section Fiber <tag> [-GJ <gj>] { <fiber/patch/layer commands> }
Note
- Geometric properties (Area, Iy, Iz, J) are computed automatically by discretizing all components into individual fibers and summing their contributions.
- OpenSees does not prevent overlapping fibers; if two fibers occupy the same space, their contributions are summed, effectively doubling the stiffness and strength at that location.
- The
GJparameter provides a linear torsional stiffness that is independent of the fibers.
Tip
- Use the
plot()method frequently during model development to verify that your fibers and patches are correctly positioned. - For large models, be mindful of the total fiber count. While more fibers increase accuracy, they also increase computation time.
- If your section only needs flexure in one plane, consider WFSection2d for simplicity.
Example
from femora.core.model import Model
import femora.components.section.fiber # noqa: F401
model = Model()
concr = model.material.uniaxial.elastic(user_name="Concrete", E=3600.0)
steel = model.material.uniaxial.steel01(
user_name="Steel",
Fy=60.0,
E0=29000.0,
b=0.01,
)
sec = model.section.fiber.section(user_name="RC_Beam", GJ=1000.0)
sec.add_rectangular_patch(
material=concr,
num_subdiv_y=10,
num_subdiv_z=10,
y1=-5,
z1=-5,
y2=5,
z2=5,
)
sec.add_fiber(y_loc=-4.5, z_loc=-4.5, area=0.44, material=steel)
print(sec.tag)
Create a FiberSection with optional initial components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_name
|
str
|
Unique identifier for the section. |
'Unnamed'
|
GJ
|
Optional[float]
|
Optional linear torsional stiffness constant. If provided, this stiffness is added to the section's torsional response. |
None
|
components
|
Optional[List[Union[FiberElement, PatchBase, LayerBase]]]
|
Optional list of pre-created fiber elements, patches, or layers to populate the section. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If GJ is not numeric or is non-positive. |
Methods:
add_fiber
Add an individual fiber at a specific (y, z) location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_loc
|
float
|
Local y-coordinate of the fiber center. |
required |
z_loc
|
float
|
Local z-coordinate of the fiber center. |
required |
area
|
float
|
Cross-sectional area of the fiber. |
required |
material
|
Union[int, str, Material]
|
Uniaxial material reference for the fiber. |
required |
add_rectangular_patch
add_rectangular_patch(material: Union[int, str, Material], num_subdiv_y: int, num_subdiv_z: int, y1: float, z1: float, y2: float, z2: float) -> None
Add a rectangular patch discretized into a grid of fibers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Union[int, str, Material]
|
Uniaxial material reference for all fibers in the patch. |
required |
num_subdiv_y
|
int
|
Number of fibers along the local y-axis. |
required |
num_subdiv_z
|
int
|
Number of fibers along the local z-axis. |
required |
y1
|
float
|
Minimum local y-coordinate of the rectangle. |
required |
z1
|
float
|
Minimum local z-coordinate of the rectangle. |
required |
y2
|
float
|
Maximum local y-coordinate of the rectangle. |
required |
z2
|
float
|
Maximum local z-coordinate of the rectangle. |
required |
add_quadrilateral_patch
add_quadrilateral_patch(material: Union[int, str, Material], num_subdiv_ij: int, num_subdiv_jk: int, vertices: list) -> None
Add a four-sided patch discretized into fibers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Union[int, str, Material]
|
Uniaxial material reference. |
required |
num_subdiv_ij
|
int
|
Subdivisions along the first direction (edge 1-2). |
required |
num_subdiv_jk
|
int
|
Subdivisions along the second direction (edge 2-3). |
required |
vertices
|
list
|
Exactly 4 (y, z) vertex pairs defining the boundary. |
required |
add_circular_patch
add_circular_patch(material: Union[int, str, Material], num_subdiv_circ: int, num_subdiv_rad: int, y_center: float, z_center: float, int_rad: float, ext_rad: float, start_ang: float = 0.0, end_ang: float = 360.0) -> None
Add a circular or arc-shaped patch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Union[int, str, Material]
|
Uniaxial material reference. |
required |
num_subdiv_circ
|
int
|
Circumferential subdivisions. |
required |
num_subdiv_rad
|
int
|
Radial subdivisions. |
required |
y_center
|
float
|
Y-coordinate of the circle center. |
required |
z_center
|
float
|
Z-coordinate of the circle center. |
required |
int_rad
|
float
|
Inner radius (0 for solid circle). |
required |
ext_rad
|
float
|
Outer radius. |
required |
start_ang
|
float
|
Starting angle in degrees. |
0.0
|
end_ang
|
float
|
Ending angle in degrees. |
360.0
|
add_straight_layer
add_straight_layer(material: Union[int, str, Material], num_fibers: int, area_per_fiber: float, y1: float, z1: float, y2: float, z2: float) -> None
Add a straight line of fibers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Union[int, str, Material]
|
Uniaxial material reference. |
required |
num_fibers
|
int
|
Number of fibers along the line. |
required |
area_per_fiber
|
float
|
Cross-sectional area of each fiber. |
required |
y1
|
float
|
Y-coordinate of start point. |
required |
z1
|
float
|
Z-coordinate of start point. |
required |
y2
|
float
|
Y-coordinate of end point. |
required |
z2
|
float
|
Z-coordinate of end point. |
required |
add_circular_layer
add_circular_layer(material: Union[int, str, Material], num_fibers: int, area_per_fiber: float, y_center: float, z_center: float, radius: float, start_ang: float = 0.0, end_ang: Optional[float] = None) -> None
Add a circular arc of fibers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Union[int, str, Material]
|
Uniaxial material reference. |
required |
num_fibers
|
int
|
Number of fibers along the arc. |
required |
area_per_fiber
|
float
|
Cross-sectional area of each fiber. |
required |
y_center
|
float
|
Y-coordinate of arc center. |
required |
z_center
|
float
|
Z-coordinate of arc center. |
required |
radius
|
float
|
Arc radius. |
required |
start_ang
|
float
|
Optional starting angle in degrees. |
0.0
|
end_ang
|
Optional[float]
|
Optional ending angle in degrees. |
None
|
get_area
Calculate the total cross-sectional area from fibers.
Returns:
| Type | Description |
|---|---|
float
|
The sum of all fiber areas. |
get_Iy
Calculate the second moment of area about the local y-axis.
Returns:
| Type | Description |
|---|---|
float
|
The computed Iy value. |
get_Iz
Calculate the second moment of area about the local z-axis.
Returns:
| Type | Description |
|---|---|
float
|
The computed Iz value. |
get_J
Approximate the torsional constant as Iy + Iz.
Note
This is a geometric polar moment of inertia approximation. If explicit
torsional stiffness is needed, use the GJ parameter in the
constructor.
Returns:
| Type | Description |
|---|---|
float
|
Sum of Iy and Iz. |
plot
plot(ax: Optional[Axes] = None, figsize: Tuple[float, float] = (10, 8), show_fibers: bool = True, show_patches: bool = True, show_layers: bool = True, show_patch_outline: bool = True, show_fiber_grid: bool = True, show_layer_line: bool = True, title: Optional[str] = None, material_colors: Optional[Dict[str, str]] = None, save_path: Optional[str] = None, dpi: int = 300) -> plt.Figure
Visualize the fiber section geometry using Matplotlib.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Optional[Axes]
|
Optional Matplotlib axes. If None, a new figure is created. |
None
|
figsize
|
Tuple[float, float]
|
Figure size for the new plot. |
(10, 8)
|
show_fibers
|
bool
|
Whether to draw small markers at each fiber location. |
True
|
show_patches
|
bool
|
Whether to draw filled polygons for patches. |
True
|
show_layers
|
bool
|
Whether to draw markers/lines for layers. |
True
|
show_patch_outline
|
bool
|
Whether to highlight the boundaries of patches. |
True
|
show_fiber_grid
|
bool
|
Whether to draw internal grid lines for patches. |
True
|
show_layer_line
|
bool
|
Whether to draw the center-line of layers. |
True
|
title
|
Optional[str]
|
Optional plot title. |
None
|
material_colors
|
Optional[Dict[str, str]]
|
Optional map from material names to color strings. |
None
|
save_path
|
Optional[str]
|
Optional file path to save the image. |
None
|
dpi
|
int
|
Resolution for the saved image. |
300
|
Returns:
| Type | Description |
|---|---|
Figure
|
The Matplotlib Figure object. |