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¶
Algorithm type flag reference¶
0: Linear
1: Linear -initial
2: Linear -secant
3: Linear -factorOnce
4: Linear -initial -factorOnce
5: Linear -secant -factorOnce
10: Newton
11: Newton -initial
12: Newton -initialThenCurrent
13: Newton -Secant
20: NewtonLineSearch
21: NewtonLineSearch -type Bisection
22: NewtonLineSearch -type Secant
23: NewtonLineSearch -type RegulaFalsi
24: NewtonLineSearch -type LinearInterpolated
25: NewtonLineSearch -type InitialInterpolated
30: ModifiedNewton
31: ModifiedNewton -initial
32: ModifiedNewton -secant
40: KrylovNewton
41: KrylovNewton -iterate initial
42: KrylovNewton -increment initial
43: KrylovNewton -iterate initial -increment initial
44: KrylovNewton -maxDim 10
45: KrylovNewton -iterate initial -increment initial -maxDim 10
50: SecantNewton
51: SecantNewton -iterate initial
52: SecantNewton -increment initial
53: SecantNewton -iterate initial -increment initial
60: BFGS
61: BFGS -initial
62: BFGS -secant
70: Broyden
71: Broyden -initial
72: Broyden -secant
80: PeriodicNewton
81: PeriodicNewton -maxDim 10
90: ExpressNewton
91: ExpressNewton -InitialTangent
100: User-defined0
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(1, 2, 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. It is not necessary to use this method.
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=False)[source]¶
Single Step Transient Analysis.
Parameters¶
- dtfloat
Time Step.
- print_info: bool, default=False
If True, print info.
Returns¶
Return 0 if successful, otherwise returns a negative number.
- StaticAnalyze(node, dof, seg, print_info=False)[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=False
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, 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.
- 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.
- 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 stress-strain histories of fiber by loc and matTag. Plot the fiber response of the material Tag
matclosest to theloc.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.
Returns¶
- Shape-(n, m, 6) Array.
N is the length of analysis steps, m is the fiber number, 6 contain (“yCoord”, “zCoord”, “area”, ‘mat’, “stress”, “strain”)
- get_limit_state(matTag=1, threshold=0, peak_drop=False)[source]¶
Get the curvature and moment corresponding to a certain limit state.
Parameters¶
- matTagint, optional
The OpenSeesPy material Tag used to determine the limit state., by default 1
- thresholdfloat, optional
The
strain thresholdused to determine the limit state by material matTag, by default 0- 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)
- 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)