aisc
aisc
Classes
ElasticSection
ElasticSection(user_name: str = 'Unnamed', *, E: float, A: float, Iz: float, Iy: Optional[float] = None, G: Optional[float] = None, J: Optional[float] = None)
Bases: Section
Linear-elastic section defined by explicit geometric and material constants.
This section represents a linear beam-column cross-section. Unlike most
other Femora sections, it does not reference a Material object; instead,
it takes material moduli (E, G) and geometric properties (A, I, J) directly
as constructor arguments.
Tcl form
- 2D:
section Elastic <tag> <E> <A> <Iz> - 3D:
section Elastic <tag> <E> <A> <Iz> <Iy> <G> <J>
Note
- This section is strictly linear. For nonlinear behavior, use FiberSection or UniaxialSection.
- When using this section in a 3D model, you must provide all six parameters (E, A, Iz, Iy, G, J). OpenSees usually expects either 3 or 6 values for the Elastic section command.
Tip
- Use this section for preliminary modeling or when physical section dimensions are unknown but aggregate properties (like equivalent stiffness) are available.
Example
from femora.core.model import Model
import femora.components.section.beam # noqa: F401
model = Model()
sec_2d = model.section.beam.elastic(
user_name="Beam2D",
E=29000.0,
A=10.0,
Iz=150.0,
)
sec_3d = model.section.beam.elastic(
user_name="Column3D",
E=29000.0,
A=26.5,
Iz=999.0,
Iy=150.0,
G=11200.0,
J=2.5,
)
print(sec_3d.tag)
Create an ElasticSection with validated geometric properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_name
|
str
|
User-specified name for the section. |
'Unnamed'
|
E
|
float
|
Young's modulus. |
required |
A
|
float
|
Cross-sectional area. |
required |
Iz
|
float
|
Second moment of area about the local z-axis. |
required |
Iy
|
Optional[float]
|
Optional second moment of area about the local y-axis (for 3D). |
None
|
G
|
Optional[float]
|
Optional shear modulus (for 3D). |
None
|
J
|
Optional[float]
|
Optional torsional constant (for 3D). |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are not numeric or if essential values (E, A, Iz) are non-positive. |
Methods:
to_tcl
Render the section as an OpenSees Tcl command.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Tcl command string for this section. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If this section has not been added to a manager. |
get_materials
Return materials used by this section.
Returns:
| Type | Description |
|---|---|
list[Material]
|
An empty list as ElasticSection does not use Material objects. |
get_area
Return the cross-sectional area.
Returns:
| Type | Description |
|---|---|
float
|
Area value. |
get_Iz
Return the second moment of area about the local z-axis.
Returns:
| Type | Description |
|---|---|
float
|
Iz value. |
get_Iy
Return the second moment of area about the local y-axis.
Returns:
| Type | Description |
|---|---|
float
|
Iy value, or 0.0 if not defined. |
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
|
to_tcl
Render the complete Fiber section command block.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Tcl command block including nested fiber, patch, and layer commands. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If this section has not been added to a manager. |
get_materials
Return all unique materials used in the section.
Returns:
| Type | Description |
|---|---|
List[Material]
|
List of unique Material objects found in any component. |
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. |
plot_components
staticmethod
plot_components(fibers: List[FiberElement], patches: List[PatchBase], layers: List[LayerBase], 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
Static utility to plot arbitrary fiber section components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fibers
|
List[FiberElement]
|
Individual fiber elements to draw. |
required |
patches
|
List[PatchBase]
|
Patch components to draw. |
required |
layers
|
List[LayerBase]
|
Layer components to draw. |
required |
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 or lines for layers. |
True
|
show_patch_outline
|
bool
|
Whether to highlight patch boundaries. |
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. |
Section
Bases: ABC
Abstract base class for all sections with manager-owned tagging.
Section objects do not self-register and do not assign their own tags.
A :class:~femora.core.section_manager.SectionManager owns lifecycle
operations, tag assignment, removal, and retagging for a local model context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section_type
|
str
|
The type of section (e.g., 'section'). |
required |
section_name
|
str
|
The specific section name for OpenSees (e.g., 'Elastic'). |
required |
user_name
|
str
|
User-specified name for the section. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
tag |
Optional[int]
|
Manager-assigned OpenSees tag. It remains |
_owner |
Optional[Any]
|
Reference to the owning manager, or |
Methods:
to_tcl
abstractmethod
Convert the section to a TCL string representation for OpenSees.
Returns:
| Type | Description |
|---|---|
str
|
TCL command string for this section. |
resolve_material
Resolve material using the owner manager when possible.
resolve_materials_dict
resolve_materials_dict(materials_input: Dict[str, Union[int, str, 'Material']]) -> Dict[str, 'Material']
Resolve a dictionary of material references.
resolve_section
Resolve another section using the owner manager when possible.
resolve_material_reference
staticmethod
resolve_material_reference(material_input: Union[int, str, 'Material', None]) -> Optional['Material']
Resolve a material object passed directly to an unmanaged section.
get_materials
Return materials used by this section for dependency tracking.
Functions:
create_section
create_section(name: str, model, material, type: str = 'Elastic', unit_system: str = 'in', user_name: str = None) -> Section
Create a Femora Section object from an AISC database name using the provided model instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
AISC section name (e.g., "W14X90"). |
required |
model
|
Model
|
Femora Model instance with a |
required |
material
|
Material
|
Femora material object. |
required |
type
|
str
|
'Elastic' or 'Fiber'. Defaults to "Elastic". |
'Elastic'
|
unit_system
|
str
|
Target unit system for geometric properties ('in', 'ft', 'm', 'cm', 'mm'). Defaults to "in". Material properties (E, G) are NOT converted. |
'in'
|
user_name
|
str
|
Custom name for the created section. If None, defaults to 'name'. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Section |
Section
|
A standard Femora section object (ElasticSection or FiberSection). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If section name is not found in database. |