FiberSecMesh¶
- class opstool.pre.section.FiberSecMesh(sec_name='My Section')[source]¶
Bases:
objectA class to mesh the cross-section with triangular fibers.
Parameters¶
- sec_namestr
Assign a name to the section.
Methods
Add the patches.
Add the rebars along a circle.
Add rebar along a line, can be a line or polygon.
Add rebars by coord points.
Move the section centroid to (0, 0).
Prints all results that have been calculated by
sectionpropertiesto the terminal.Return section area.
Return the centroid.
Return the distance from section edge to the centroid.
Return fiber data.
Calculates and returns the properties required for a frame analysis.
Return the total geometric area of a section.
Return Moment of inertia of the section around the y-axis.
Return Moment of inertia of the section around the z-axis.
Return section torsion constant.
Return the group dict for each geometry obj.
Returns the total area of rebars.
Returns the number of rebars.
Solving Section Geometry Properties by Finite Element Method, by
sectionpropertiespacakge.Return the section object.
Return the section geometry.
Calculates the cross-section stress resulting from design actions and returns a list of dictionaries containing the cross-section stresses for each region by method
assign_group().Mesh the section.
Rotate the section clockwise.
Rotate the patch group.
Assign the color to plot the section.
Assign the mesh size dict for each mesh.
Assign the opensees mat tag for each mesh.
Output the opensees fiber code to file.
Generate openseespy fiber section command.
Display the section mesh.
- add_patch_group(patches)[source]¶
Add the patches.
Parameters¶
- patchesdict[str, patch]|patch|List[patch]
patch: Geometry as value.
Returns¶
SecMesh instance
- get_patch_group()[source]¶
Return the group dict for each geometry obj.
Returns¶
group : dict[str, any]
- rotate_section_geometry(angle, rot_point='center')[source]¶
Rotate the patch group. Rotates the patch and specified angle about a point. If the rotation point is not provided, rotates the section about the center.
Parameters¶
- anglefloat
Angle (degrees by default) by which to rotate the section. A positive angle leads to a clockwise rotation.
- rot_pointtuple[float, float]
Point (x, y) about which to rotate the section. If not provided, will rotate about the center of the bounding box. Defaults to “center”.
- set_mesh_size(mesh_size)[source]¶
Assign the mesh size dict for each mesh.
Parameters¶
- mesh_sizedict[str, float] | list[float] | float
The mesh sizes describe the maximum mesh element size to be used in the finite-element mesh for each Geometry object.
If dict, name as the key, mesh size as value.
If floated, all geoms will use the same meshsize.
If list or tuple, the length must be the same as the geoms.
Returns¶
instance
- set_ops_mat_tag(mat_tag)[source]¶
Assign the opensees mat tag for each mesh.
Parameters¶
- mat_tagdict[str, int] | list[int] | int
If dict, name as a key, OpenSees matTag previously defined as value.
If list or tuple, the length must be the same as the geom patches.
If int, all patches will use the same matTag.
Returns¶
instance
- set_mesh_color(colors)[source]¶
Assign the color to plot the section.
Parameters¶
- colorsdict[str, str] | list[str|list|tuple] | str
If dict, the patch name as a key, color as value.
- get_section_geometry()[source]¶
Return the section geometry.
Returns¶
- section_geom: Geometry or CompoundGeometry
The section geometry object.
- mesh()[source]¶
Mesh the section.
If set_mesh_size has not been invoked, the mesh size of each Geometry will be calculated by its area / 100.
Returns¶
None
- get_fiber_data()[source]¶
Return fiber data.
Returns¶
- Tuple(dict, dict)
fiber center dict, fiber area dict
- add_rebar_points(points, dia, ops_mat_tag=None, color='black', group_name='Rebar')[source]¶
Add rebars by coord points.
Parameters¶
- points: list[list[float, float]]
A list of rebar coords, [(x1, y1), (x2, y2),…,(xn, yn)], in which each element represents a rebar point.
- dia: float
Rebar diameter.
- ops_mat_tag: int
OpenSees mat Tag for rebar previously defined.
- color: str or rgb tuple.
Color to plot rebar.
- group_name: str, default=’Rebar’
Assign rebar group name
Returns¶
None
- add_rebar_line(points, dia, gap=0.1, n=None, closure=False, ops_mat_tag=None, color='black', group_name='Rebar')[source]¶
Add rebar along a line, can be a line or polygon.
Parameters¶
- points: list[list[float, float]]
A list of rebar coords, [(x1, y1), (x2, y2),…,(xn, yn)], in which each element represents a corner point, and every two corner points are divided by the arg gap.
- dia: float
Rebar diameter.
- gap: float, default=0.1
Rebar space.
- n: int, default=None
The number of rebars, if not None, update the Arg gap according to n. This means that if you know the number of rebars, you don’t need to input gap or set gap to any number.
- closure: bool, default=False
If True, the rebar line is a closed loop.
- ops_mat_tag: int
OpenSees mat Tag for rebar previously defined.
- color: str or rgb tuple.
Color to plot rebar.
- group_name: str, default=’Rebar’
Assign rebar group name
Returns¶
None
- add_rebar_circle(xo, radius, dia, gap=0.1, n=None, angles=(0.0, 360), ops_mat_tag=None, color='black', group_name='Rebar')[source]¶
Add the rebars along a circle.
Parameters¶
- xo: list[float, float]
Center coords of circle, [(xc, yc)].
- radius: float
Radius of circle.
- dia: float
rebar dia.
- gap: float, default=0.1
Rebar space.
- n: int, default=None
The number of rebars, if not None, update the Arg gap according to n. This means that if you know the number of rebars, you don’t need to input gap or set gap to any number.
- angles: Union[list, tuple], default=[0.0, 360]
The start angle and end angle, degree.
- ops_mat_tag: int, defaultt=None
OpenSees material matTag for rebar previously defined.
- color: str or rgb tuple.
Color to plot rebar.
- group_name: str, default=’Rebar’
Assign rebar group name.
Returns¶
None
- get_rebars_area()[source]¶
Returns the total area of rebars.
Returns¶
area: float, total area of rebars.
- get_area()[source]¶
Return section area. For a single-material section, it is the geometric area, and for a composite section, it is the equivalent area.
Returns¶
area: float, section area.
- get_geom_area()[source]¶
Return the total geometric area of a section.
Returns¶
area: float, section area.
- get_iy()[source]¶
Return Moment of inertia of the section around the y-axis.
Returns¶
iy: float, Moment of inertia of the section around the y-axis.
- get_iz()[source]¶
Return Moment of inertia of the section around the z-axis.
Returns¶
iz: float, Moment of inertia of the section around the z-axis.
- get_dist_from_centroid()[source]¶
Return the distance from section edge to the centroid.
Returns¶
- list, [ztop, zbot, yright, yleft]
z axis top, z axis bottom, y-axis right, y-axis left
- get_sec_props(Eref=1.0, display_results=False, fmt='8.3E', plot_centroids=False)[source]¶
Solving Section Geometry Properties by Finite Element Method, by
sectionpropertiespacakge. See sectionproperties resultsThis command may be slower. If you don’t need features such as shear area, you can use method
get_frame_props().Parameters¶
- Eref: float, default=1.0
Reference modulus of elasticity, it is important to analyze the composite section. If it is not a composite section, please ignore this parameter.
- display_resultsbool, default=True
whether to display the results.
- fmtstr, optional
Number formatting string when display_results=True.
- plot_centroidsbool, default=False
whether to plot centroids.
Returns¶
- sec_props: dict
section props dict, including:
Cross-sectional area (A)
Shear area (Asy, Asz)
Elastic centroid (centroid)
Second moments of area about the centroidal axis (Iy, Iz, Iyz)
Elastic section moduli about the centroidal axis with respect to the top and bottom fibres (Wyt, Wyb, Wzt, Wzb)
Torsion constant (J)
Principal axis angle (phi)
Section mass (mass), only true if material density is defined, otherwise geometric area (mass density is 1)
ratio of reinforcement (rho_rebar)
Note
If it is not a composite section, please ignore the Eref parameter; Otherwise, please use the Eref parameter, all section properties will be transformed according to the reference material, and the mechanical properties of the reference material are then used in the practical analysis.
Note that according to the OpenSees convention, the x-axis refers to the normal direction of the section, the y-axis refers to the abscissa, and the z-axis refers to the ordinate direction.
- get_frame_props(Eref=1.0, display_results=False, fmt='8.3E')[source]¶
Calculates and returns the properties required for a frame analysis. See sectionproperties frame_properties
This method is fast, but cannot calculate the shear area compared to the method
get_sec_props().Parameters¶
- Eref: float, default=1.0
Reference modulus of elasticity, it is important to analyze the composite section. If it is not a composite section, please ignore this parameter. See https://sectionproperties.readthedocs.io/en/latest/user_guide/results.html#label-material-affects-results
- display_resultsbool, default=True
whether to display the results.
- fmtstr, optional
Number formatting string when display_results=True.
Returns¶
- sec_props: dict
section props dict, including:
Cross-sectional area (A)
Elastic centroid (centroid)
Second moments of area about the centroidal axis (Iy, Iz, Iyz)
Elastic section moduli about the centroidal axis with respect to the top and bottom fibers (Wyt, Wyb, Wzt, Wzb)
Torsion constant (J)
Principal axis angle (phi)
Section mass (mass), only true if material density is defined, otherwise geometric area (mass density is 1)
ratio of reinforcement (rho_rebar)
Note
If it is not a composite section, please ignore the Eref parameter; Otherwise, please use the Eref parameter, all section properties will be transformed according to the reference material, and the mechanical properties of the reference material are then used in the practical analysis.
Note that according to the OpenSees convention, the x-axis refers to the normal direction of the section, the y-axis refers to the abscissa, and the z-axis refers to the ordinate direction.
- display_all_results(Eref=1.0, fmt='8.6e')[source]¶
Prints all results that have been calculated by
sectionpropertiesto the terminal.Parameters¶
- Eref: float, default=1.0
Reference modulus of elasticity, it is important to analyze the composite section. If it is not a composite section, please ignore this parameter. See sectionproperties document
- fmtstr, optional
Number formatting string.
- get_stress(N=0, Vy=0, Vz=0, Myy=0, Mzz=0, Mxx=0, plot_stress='all', cmap='YlOrBr', normalize=False, fmt='{x:.4e}', colorbar_label='Stress', alpha=0.75, **kargs)[source]¶
Calculates the cross-section stress resulting from design actions and returns a list of dictionaries containing the cross-section stresses for each region by method
assign_group().Note
This function is only available for elastic stress analysis, and reinforcement is ignored. The stresses are realistic only if you specify the correct material for each geometry region.
Parameters¶
- Nfloat, optional
Axial force, by default 0
- Vyfloat, optional
Shear force acting in the y-direction, by default 0
- Vzfloat, optional
Shear force acting in the z-direction, by default 0
- Myyfloat, optional
Bending moment about the centroidal yy-axis, by default 0
- Mzzfloat, optional
Bending moment about the centroidal zz-axis, by default 0
- Mxxfloat, optional
Torsion moment about the centroidal xx-axis, by default 0
- plot_stressstr, optional
plot the various cross-section stresses, by default None. Note that according to the OpenSees convention, the x-axis refers to the normal direction of the section, the y-axis refers to the abscissa, and the z-axis refers to the ordinate direction. Optional as follows (if plot_stress=”all”, will plot all stress types):
Combined Stress Plots:
“xx”–combined normal stress resulting from all actions;
“xy”–y-component of the shear stress resulting from all actions;
“xz”– z-component of the shear stress resulting from all actions;
“xyz”–resultant shear stress resulting from all actions;
“p1”–major principal stress resulting from all actions;
“p3”– Minor principal stress resulting from all actions;
“vm”–von Mises stress resulting from all actions;
Primary Stress Plots:
“n_xx”–normal stress resulting from the axial load N;
“myy_xx”–normal stress resulting from the bending moment Myy;
“mzz_xx”–normal stress resulting from the bending moment Mzz;
“m_xx”–normal stress resulting from all bending moments Myy+Mzz;
“mxx_xy”–y-component of the shear stress resulting from the torsion moment Mxx;
“mxx_xz”–z-component of the shear stress resulting from the torsion moment Mxx;
“mxx_xyz”–resultant shear stress resulting from the torsion moment Mxx;
“vy_xy”–y-component of the shear stress resulting from the shear force Vy;
“vy_xz”–z-component of the shear stress resulting from the shear force Vy;
“vy_xyz”–resultant shear stress resulting from the shear force Vy;
“vz_xy”–y-component of the shear stress resulting from the shear force Vz;
“vz_xz”–z-component of the shear stress resulting from the shear force Vz;
“vz_xyz”–resultant shear stress resulting from the shear force Vz;
“v_xy”–y-component of the shear stress resulting from the sum of the applied shear forces Vy+Vz;
“v_xz”–z-component of the shear stress resulting from the sum of the applied shear forces Vy+Vz;
“v_xyz”–resultant shear stress resulting from the sum of the applied shear forces Vy+Vz;
- cmapstr, optional
Matplotlib color map, by default ‘coolwarm’
- normalizebool, optional
If set to true, the CenteredNorm is used to scale the colormap. If set to false, the default linear scaling is used., by default True
- fmt: str
Number formatting string, see here
- colorbar_label: str, default=’Stress’
Colorbar label
- alpha: float, default=0.75
Transparency of the mesh outlines
Returns¶
- list[dict]:
A list of dictionaries containing the cross-section stresses for each region by method
assign_group().
- rotate(theta=0, rot_point='center', remesh=False)[source]¶
Rotate the section clockwise.
Parameters¶
- thetafloat, default=0
Rotation angle, unit: degree.
- rot_pointtuple[float, float], default=(‘center’, ‘center’)
Point (x, y) about which to rotate the section. If not provided, will rotate about the center. Defaults to “center”.
- remeshbool, default=False
If True, will remesh the section. So the cross-section properties will be updated. If False, Only the existing mesh will be rotated, and the cross-section properties will not be updated
Returns¶
None
- to_opspy_cmds(secTag, GJ=None, G=None, is_thermal=False)[source]¶
Generate openseespy fiber section command.
Parameters¶
- secTagint
The section tag assigned in OpenSees.
- GJ: float, default = None
Torsion stiffness. Note that at least one of GJ and G needs to be specified, and if both, it will be calculated by GJ.
- G: float, default = None
Shear modulus. The program automatically calculates the torsion constant. Note that at least one of GJ and G needs to be specified, and if both, it will be calculated by GJ.
- is_thermalbool, default=False
If True, will output a FiberThermal section instead of a Fiber section. This is useful for thermal analysis in OpenSees.
Returns¶
None
- to_file(output_path, secTag, GJ=None, G=None, fmt=':.6E', is_thermal=False)[source]¶
Output the opensees fiber code to file.
Parameters¶
- output_pathstr
The filepath to save, e.g., r “my_dir/my_section.py”
Note
Notes that output_path must be endswith
.pyor.tcl, function will create the file by the right style.- secTagint
The section tag assigned in OpenSees.
- GJ: float, default = None
Torsion stiffness. Note that at least one of GJ and G needs to be specified, and if both, it will be calculated by GJ.
- G: float, default = None
Shear modulus. The program automatically calculates the torsion constant. Note that at least one of GJ and G needs to be specified, and if both, it will be calculated by GJ.
- fmtstr, default = “:.6E”
Formatting style for floating point numbers.
- is_thermalbool, default=False
If True, will output a FiberThermal section instead of a Fiber section. This is useful for thermal analysis in OpenSees.
Returns¶
None
- view(fill=True, show_legend=True, aspect_ratio=None, ax=None)[source]¶
Display the section mesh.
Parameters¶
- fillbool, default=True
Whether to fill the trangles.
- show_legend: bool, default=True
Whether to show the legend.
- aspect_ratio: float or str, default=None
Aspect ratio of the figure.
- axmatplotlib.axes.Axes, optional
The axes to plot the section mesh.
returns¶
- axmatplotlib.axes.Axes
The axes with the section mesh plotted.