Analysis¶
Smart Analysis¶
- class opstool.anlys.SmartAnalyze(analysis_type='Transient', **kargs)[source]¶
The SmartAnalyze is a class to provide OpenSeesPy users an easier way to conduct analyses. Original Tcl version Author: Dr. Dong Hanlin, see here. Here’s the converted python version, with some modifications.
Parameters¶
- analysis_type: str, default=”Transient”
Assign the analysis type, “Transient” or “Static”.
Other Parameters that control convergence¶
Examples¶
The following example demonstrates how to use the SmartAnalyze class.
Note
test()andalgorithm()will run automatically inSmartAnalyze, but commands such asintegrator()must be defined outsideSmartAnalyze.Example 1: Basic usage for Transient
>>> import opstool as opst >>> ops.constraints('Transformation') >>> ops.numberer('Plain') >>> ops.system('BandGeneral') >>> ops.integrator('Newmark', 0.5, 0.25) >>> analysis = opst.anlys.SmartAnalyze(analysis_type="Transient") >>> npts, dt = 1000, 0.01 >>> segs = analysis.transient_split(npts) >>> for seg in segs: >>> analysis.TransientAnalyze(dt)
Example 2: Basic usage for Static
>>> import opstool as opst >>> ops.constraints('Transformation') >>> ops.numberer('Plain') >>> ops.system('BandGeneral') >>> protocol=[1, -1, 1, -1, 0] >>> analysis = opst.anlys.SmartAnalyze(analysis_type="Static") >>> segs = analysis.static_split(protocol, 0.01) >>> print(segs) >>> for seg in segs: >>> analysis.StaticAnalyze(node=1, dof=2, seg=seg) # node tag 1, dof 2
Example 3: change control parameters
>>> analysis = opst.anlys.SmartAnalyze( >>> analysis_type="Transient", >>> algoTypes=[40, 30, 20], >>> printPer=20, >>> tryAlterAlgoTypes=True, >>>)
- transient_split(npts)[source]¶
Step Segmentation for Transient Analysis. The main purpose of this function is to tell the program the total number of analysis steps to show progress. However, this is not necessary.
Parameters¶
- nptsint
Total steps for transient analysis.
Returns¶
A list to loop.
- static_split(targets, maxStep=None)[source]¶
Returns a sequence of substeps for static analysis, for use in outer analysis loops. It is not necessary to use this method if you already have a load sequence.
Parameters¶
- targets: Union[list, tuple, numpy.ndarray]
A list of target displacements, the first element must be positive.
- maxStep: float, default=None
The maximum step size in the displacement control. If None, targets[1] - targets[0].
Returns¶
- segs: list
A sequence of substeps for static analysis.
- TransientAnalyze(dt, print_info=True)[source]¶
Single Step Transient Analysis.
Parameters¶
- dtfloat
Time Step.
- print_info: bool, default=True
If True, print info.
Returns¶
Return 0 if successful, otherwise returns a negative number.
- StaticAnalyze(node, dof, seg, print_info=True)[source]¶
Single step static analysis and applies to displacement control only.
Parameters¶
- nodeint
The node tag in the displacement control.
- dofint
The dof in the displacement control.
- segfloat
Each load step, i.e., each element returned by static_split.
- print_info: bool, default=True
If True, print info.
Returns¶
Return 0 if successful, otherwise returns a negative number.
Moment-Curvature Analysis of Sections¶
- class opstool.anlys.MomentCurvature(sec_tag, axial_force=0)[source]¶
Moment-Curvature Analysis for Fiber Section in OpenSeesPy.
Parameters¶
- sec_tagint,
The previously defined section Tag.
- axial_forcefloat, optional
Axial load, compression is negative, by default 0
- analyze(axis='y', max_phi=0.5, incr_phi=0.0001, limit_peak_ratio=0.8, cycle_analyze=False, smart_analyze=True, debug=False)[source]¶
Performing Moment-Curvature Analysis.
Parameters¶
- axisstr, optional, “y” or “z”
The axis of the section to be analyzed, by default “y”.
- max_phifloat, optional
The maximum curvature to analyze, by default 0.5.
- incr_phifloat, optional
Curvature analysis increment, by default 1e-4.
- limit_peak_ratiofloat, optional
A ratio of the moment intensity after the peak used to stop the analysis., by default 0.8, i.e., a 20% drop after peak.
- cycle_analyzebool, optional
Whether to perform cyclic analysis, by default False.
- smart_analyzebool, optional
Whether to use smart analysis options, by default True.
- debug: bool, optional
Whether to use debug mode when smart analysis is True, by default, False.
Note
The termination of the analysis depends on whichever reaches max_phi or post_peak_ratio first.
- set_cycle_path(max_phi, n_cycle=20, n_hold=1)[source]¶
set a deformation cycle path.
Parameters¶
- max_phifloat
Peak of the path.
- n_cycleint, optional
Number of cycles, by default 20
- n_holdint, optional
The number of repetitions for each cycle., by default 1
Note
The total number of cycles is n_cycle * n_hold.
Returns¶
- 1D Arraylike.
Displacement path sequence
- plot_M_phi(ax=None)[source]¶
Plot the moment-curvature relationship.
Parameters¶
- axmatplotlib.axes.Axes, optional
The axes to plot the moment-curvature relationship, by default None.
- plot_fiber_responses(return_ax=False)[source]¶
Plot the fiber responses.
Parameters¶
- return_ax: bool, default=False
If True, return the axes for the plot of matplotlib.
- get_M_phi()[source]¶
Get the moment and curvature array.
Returns¶
- (1D array-like, 1D array-like)
(Curvature array, Moment array)
- get_fiber_data()[source]¶
All fiber data.
- Return type:
DataArray
Returns¶
- FiberData: xr.DataArray
All fiber data. “Steps” is the number of steps in the analysis. “Fibers” is the number of fibers in the section. “Properties” is the properties of the fibers, including “yloc”, “zloc”, “area”, “mat”, “stress”, “strain”.
- get_limit_state(matTag=1, threshold=0.0, peak_drop=False)[source]¶
Get the curvature and moment corresponding to a certain limit state.
Parameters¶
- matTagUnion[list[int], int]
The OpenSeesPy material Tag used to determine the limit state., by default 1
- thresholdUnion[list[float], float]
The
strain thresholdused to determine the limit state by material matTag, by default 0. The positive and negative signs are meaningful for tension and compression.
Note
If
matTagis a list, the length of matTag and threshold should be the same. As long as any material reaches its corresponding threshold, it will be set to the limit state.- peak_dropUnion[float, bool], optional, by default False.
If True, A default 20% drop from the peak value of the moment will be used as the limit state; If float in [0, 1], this means that the ratio of ultimate strength to peak value is specified by this value, for example, peak_drop = 0.3, the ultimate strength = 0.7 * peak. matTag and threshold are not needed.
Note
When using
peak_drop, matTag and strain threshold will be ignored!Returns¶
- (float, float)
(Limit Curvature, Limit Moment)
Examples¶
>>> sec = MomentCurvature(sec_tag=1) >>> sec.analyze(axis="y", max_phi=1.0, incr_phi=1e-4, limit_peak_ratio=0.8) >>> # Get the limit state by material Tag 1 and strain threshold 0.002 >>> sec.get_limit_state(matTag=1, threshold=0.002) >>> sec.get_limit_state(peak_drop=0.20)
- bilinearize(phiy, My, phiu, plot=False, ax=None)[source]¶
Bilinear Approximation of Moment-Curvature Relation.
Parameters¶
- phiyfloat
The initial yield curvature.
- Myfloat
The initial yield moment.
- phiufloat
The limit curvature.
- plotbool, optional
If True, plot the bilinear approximation, by default, False.
- axmatplotlib.axes.Axes, optional
The axes to plot the bilinear approximation, by default None.
Returns¶
- (float, float)
(Equivalent Curvature, Equivalent Moment)