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 a material object, tag, or name in this section's context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_input
|
int | str | Material | None
|
Material reference. Objects pass through unchanged and None remains None. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
material |
Material | None
|
Resolved dependency without copying. |
Raises:
| Type | Description |
|---|---|
ValueError
|
A name/tag cannot be resolved, or no owner is available to perform the lookup. Direct objects do not require an owner. |
resolve_materials_dict
resolve_materials_dict(materials_input: Dict[str, Union[int, str, 'Material']]) -> Dict[str, 'Material']
Resolve each value of a dependency mapping, preserving its keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
materials_input
|
dict[str, int | str | Material]
|
Named references
interpreted by |
required |
Returns:
| Name | Type | Description |
|---|---|---|
materials |
dict[str, Material]
|
New mapping containing resolved objects. Lookup failures propagate; input is not mutated. |
resolve_section
Resolve a section object, integer tag, or user name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
section_input
|
int | str | Section | None
|
Dependency reference. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
section |
Section | None
|
Direct object, looked-up section, or None for None input. Existing objects are neither copied nor registered. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Lookup fails or an unmanaged section is asked to resolve a name/tag without an owning manager. |
resolve_material_reference
staticmethod
resolve_material_reference(material_input: Union[int, str, 'Material', None]) -> Optional['Material']
Accept a direct material object without a manager lookup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_input
|
int | str | Material | None
|
Only Material objects and None can be resolved by this context-free helper. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
material |
Material | None
|
Original object, or None. |
Raises:
| Type | Description |
|---|---|
ValueError
|
A name, tag, or other unsupported value is supplied. |
get_materials
Return this base section's direct material dependency as a new list.
The base returns [self.material] or an empty list. Composite/fiber
implementations override this hook to report their own dependencies.
Material objects are shared, not copied.
has_material
Report whether the base material attribute is non-None.
Concrete section families may override this hook. The base does not search arbitrary nested sections or fiber collections.
get_area
Return section area in squared model length units.
The base returns 0.0 as a fallback, not an integrated geometric result. Implementations with area information must override the hook.
get_Iy
Return the local-y second moment in length-to-the-fourth units.
The base returns 0.0. A concrete section must override this method when a consuming element requires its bending property.
get_Iz
Return the local-z second moment in length-to-the-fourth units.
The base returns 0.0 rather than deriving geometry from materials or discretized fibers. Concrete implementations supply the property.
Functions:
get_section_properties
Read AISC geometry without creating a material or an OpenSees section.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
W or rectangular HSS shape in the bundled database. |
required |
unit_system
|
str
|
Geometry units: in, ft, m, cm, or mm. |
'in'
|
Returns:
| Type | Description |
|---|---|
Dict[str, float]
|
Area A, local bending inertias Iy/Iz, Saint-Venant torsional constant |
Dict[str, float]
|
J, and dimensions d, bf, tw, tf. Local Iy is AISC strong-axis Ix. |
Dict[str, float]
|
No elastic modulus, shear modulus, density, or stiffness is inferred. |
create_section
create_section(name: str, model, material, type: str = 'Elastic', unit_system: str = 'in', user_name: str = None, *, GJ: Optional[float] = None, flange_fibers: Tuple[int, int] = (12, 4), web_fibers: Tuple[int, int] = (4, 16)) -> Section
Create a managed elastic or fiber section from an AISC shape name.
Supports W shapes and rectangular/square HSS shapes in the bundled database.
type="Elastic" uses tabulated area, inertias, and torsional constant.
type="Fiber" creates three rectangular patches for W shapes or four
nonoverlapping wall patches for HSS shapes.
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
|
GJ
|
Optional[float]
|
Finite positive elastic torsional stiffness, required for 3D fiber sections. It is stiffness (shear modulus times torsional constant), not J alone. Ignored for elastic sections, which obtain G and J from the reference material and database. |
None
|
flange_fibers
|
Tuple[int, int]
|
Pair |
(12, 4)
|
web_fibers
|
Tuple[int, int]
|
Pair |
(4, 16)
|
Returns:
| Name | Type | Description |
|---|---|---|
Section |
Section
|
A standard Femora section object (ElasticSection or FiberSection). |
Raises:
| Type | Description |
|---|---|
ValueError
|
Shape, units, fiber counts, dimensions, GJ, or fiber material are invalid. Fiber materials must be uniaxial and managed by model. |
Note
Materials. Elastic sections use a reference material's E and G/nu. Fibers require a uniaxial stress-strain material, such as Elastic or Steel01. Choosing fibers alone does not imply yielding: the assigned material controls the response. Material parameters are never converted.
Axes. Local x runs along the member. Section width is local y and
depth is local z. AISC strong-axis Ix maps to local Iy; AISC weak-axis
Iy maps to local Iz. get_Iy() and get_Iz() on the returned
section follow these local axes, independently of its global orientation.
Approximation. Fiber patches omit W fillets and use sharp HSS corners with nominal outer dimensions and tabulated design thickness. Their area and inertias therefore need not equal database values exactly. Increasing fiber counts reduces discretization error, not geometric approximation error. Fibers do not model local plate buckling.
Torsion. GJ remains elastic even when axial/bending fibers yield.
FiberSection.get_J() returns a geometric approximation, not the
tabulated Saint-Venant torsional constant used to choose GJ.
Examples:
Create elastic and yielding W sections in m, kN, tonne, s:
from femora import Model
from femora.tools.sections import aisc
model = Model()
reference = model.material.nd.elastic_isotropic(
user_name="reference", E=200e6, nu=0.3, rho=7.85,
)
elastic = aisc.create_section(
"W14X90", model, reference, unit_system="m", user_name="column_elastic",
)
steel = model.material.uniaxial.steel01(
user_name="steel", Fy=345000, E0=200e6, b=0.01,
)
fiber = aisc.create_section(
"W14X90", model, steel, type="Fiber", unit_system="m",
user_name="column_fiber", GJ=elastic.G * elastic.J,
flange_fibers=(12, 4), web_fibers=(4, 16),
)
print(elastic.get_Iy(), fiber.get_Iy())
print(elastic.get_Iz(), fiber.get_Iz())
# fiber.plot() displays the cross-section patches and fibers.
Refine both section directions for a sensitivity check:
fine = aisc.create_section(
"W14X90", model, steel, type="Fiber", unit_system="m",
user_name="column_fine", GJ=elastic.G * elastic.J,
flange_fibers=(24, 8), web_fibers=(8, 32),
)
Create a rectangular tube with the same material law. The fiber generator uses four walls; no special brace buckling behavior is added: