SmartAnalyze¶
- class opstool.anlys.SmartAnalyze(analysis_type='Transient', **kargs)[source]¶
Bases:
objectThe 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, >>>)
Methods
Single step static analysis and applies to displacement control only.
Single Step Transient Analysis.
Set analysis sensitivity algorithm.
Returns a sequence of substeps for static analysis, for use in outer analysis loops.
Step Segmentation for Transient Analysis.
- 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.
- set_sensitivity_algorithm(algorithm='-computeAtEachStep')[source]¶
Set analysis sensitivity algorithm. Since the Smart Static Analysis may reset the integrator, the sensitivity analysis algorithm will need to be reset afterwards.
Parameters¶
- algorithm: Sensitivity analysis algorithm, default: “-computeAtEachStep”.
Optional: “-computeAtEachStep” or “-computeByCommand”.
Return¶
None
- 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.