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() and algorithm() will run automatically in SmartAnalyze, but commands such as integrator() must be defined outside SmartAnalyze.

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, 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 fiber responses.

Parameters

return_ax: bool, default=False

If True, return the axes for the plot of matplotlib.

get_phi()[source]

Get the curvature array.

Returns

phi: 1D array-like

Curvature array.

get_curvature()[source]

Get the curvature array.

Returns

phi: 1D array-like

Curvature array.

get_M()[source]

Get the moment array.

Returns

m: 1D array-like

Moment array.

get_moment()[source]

Get the moment array.

Returns

m: 1D array-like

Moment array.

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 threshold used to determine the limit state by material matTag, by default 0 The positive and negative signs are meaningful for tension and compression.

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)