### Setup Analysis with Element Modification Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-ele-removal-add.html Initializes a model and database for an analysis involving element removal and addition. ```python # Case CASE_2 = 2 """Ok, For case 2 I want to remove and add element during analysis.""" # Create model model_info = triangleStruc(top_free=True, base_free=True, info=False) # Create data base ODB = opst.post.CreateODB(odb_tag=CASE_2, fiber_ele_tags="ALL", model_update=True) # Linear timeSeries ts = 1 ops.timeSeries("Linear", ts) # Pattern for static analysis pattern_1 = 100 ops.pattern("Plain", pattern_1, ts) ops.load(model_info.ctrl_node, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0) ``` -------------------------------- ### Setup Pushover Analysis Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-MRF-2Story-Concentrated-PanelZone.html Sets up the parameters for a static pushover analysis, including defining lateral loads and analysis constraints. ```python lat2 = 16.255 lat3 = 31.636 ops.timeSeries("Linear", 200) ops.pattern("Plain", 200, 200) ops.load(1205, lat2, 0.0, 0.0) ops.load(2205, lat2, 0.0, 0.0) ops.load(1305, lat3, 0.0, 0.0) ops.load(2305, lat3, 0.0, 0.0) IDctrlNode = 1305 IDctrlDOF = 1 Dmax = 0.1 * HBuilding Dincr = 0.05 ops.wipeAnalysis() ops.constraints("Plain") ops.numberer("RCM") ops.system("BandGeneral") ops.test("NormUnbalance", 1.0e-5, 400) ops.algorithm("Newton") ops.integrator("DisplacementControl", IDctrlNode, IDctrlDOF, Dincr) ops.analysis("Static") ``` -------------------------------- ### Pushover Analysis Output Example Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-MRF-2Story-Concentrated-PanelZone.html This is an example output showing the structure of displacement and reaction data loaded from an .odb file. It includes the shape and coordinates of the xarray DataArrays. ```text OPSTOOL™ :: Loading disp response data from G:\opstool\docs\.opstool.output\RespStepData-pushover.odb ... OPSTOOL™ :: Loading reaction response data from G:\opstool\docs\.opstool.output\RespStepData-pushover.odb ... Size: 1MB array([[[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -4.4436118e-07], ..., [ 1.8685561e-04, -2.7262092e-02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -4.1580705e-08], [ 1.8685561e-04, -2.7262092e-02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -6.9950938e-09], [ 1.8694965e-04, -2.7277712e-02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -6.8283303e-09]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -1.4927976e-04], ... 0.0000000e+00, -1.0054388e-01], [ 3.1038769e+01, 1.1918640e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -9.6789598e-02], [ 3.2350239e+01, 1.1917404e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -9.6783288e-02]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -9.8876216e-02], ..., [ 3.1086489e+01, 1.1939133e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -1.0070825e-01], [ 3.1086489e+01, 1.1939133e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -9.6957892e-02], [ 3.2400238e+01, 1.1937901e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -9.6951604e-02]]], shape=(649, 72, 6), dtype=float32) Coordinates: * time (time) float32 3kB 0.0 0.06466 0.1293 0.194 ... 1.098 1.093 1.089 * nodeTags (nodeTags) int64 576B 11 21 31 32 33 ... 2306 2307 2308 2309 2310 * DOFs (DOFs) Size: 1MB array([[[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 7.9213899e-01], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 7.9221976e-01], [ 3.5074761e-04, 7.8933002e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 5.1174906e-15], ..., [ 5.2678199e-03, -3.3429100e+01, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -1.3585577e-11], [-5.2678199e-03, 3.3429100e+01, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 1.3946830e-12], [ 6.2170668e-13, 8.3772989e-12, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -9.6687519e-12]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 3.9567642e+02], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 3.9567175e+02], [ 1.1783099e-01, 7.8933002e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ... 0.0000000e+00, -1.0266831e-08], [-1.7378375e+02, 2.6457239e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -3.6235883e-07], [-1.7751367e-07, 1.6630082e-08, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 2.2146787e-07]], [[ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 1.6660080e+04], [ 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 1.6660518e+04], [ 7.8045967e+01, 7.8933002e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], ..., [ 1.7317819e+02, -2.6378641e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, -1.1087877e-08], [-1.7317812e+02, 2.6378647e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 2.6137354e-07], [ 2.9309660e-08, -2.5756037e-09, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 2.9473085e-07]]], shape=(649, 72, 6), dtype=float32) ``` -------------------------------- ### Pushover Analysis Output Log Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-2DFrame-Pushover.html Example output log generated upon successful completion of the pushover analysis. ```text OPSTOOL™ :: All responses data with _odb_tag = 1 saved in G:\opstool\docs\.opstool.output\RespStepData-1.odb! Pushover analysis completed. ``` -------------------------------- ### Dynamic Analysis Configuration Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-PressureDependMultiYield-6.html Prepares the model for dynamic analysis by resetting the time and wiping the previous analysis setup. This section is a placeholder for further dynamic analysis configuration. ```python # =============================================================== # DYNAMIC ANALYSIS CONFIGURATION # =============================================================== ``` -------------------------------- ### Example DataArray for Stress Measures Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-PressureDependMultiYield-6.html This is an example of the xarray.DataArray structure for 'StressMeasures', showing dimensions, shape, and coordinates for time, GaussPoints, eleTags, and measures. ```python Size: 51kB array([[1.541493 , 1.541493 , 1.541493 , ..., 1.541493 , 1.541493 , 1.541493 ], [1.541422 , 1.541422 , 1.541422 , ..., 1.541422 , 1.541422 , 1.541422 ], [1.5525209 , 1.5525209 , 1.5525209 , ..., 1.5525209 , 1.5525209 , 1.5525209 ], ..., [0.36760953, 0.36760953, 0.36760953, ..., 0.36760953, 0.36760953, 0.36760953], [0.36760953, 0.36760953, 0.36760953, ..., 0.36760953, 0.36760953, 0.36760953], [0.36760953, 0.36760953, 0.36760953, ..., 0.36760953, 0.36760953, 0.36760953]], shape=(1601, 8), dtype=float32) Coordinates: * time (time) float32 6kB 0.0 0.01 0.02 0.03 ... 15.98 15.99 16.0 * GaussPoints (GaussPoints) int64 64B 1 2 3 4 5 6 7 8 eleTags int64 8B 1 measures tuple[np.ndarray, np.ndarray]: """ # Static analysis function :param targets: Displacement path :param patternTag: Pattern tag :param ctrl_node: Control node tag :param ODB: CreateODB object :return: Displacement and force """ ops.system("BandGeneral") ops.constraints("Transformation") ops.numberer("RCM") analysis = opst.anlys.SmartAnalyze("Static") segs = analysis.static_split(targets=targets, maxStep=0.01 * UNIT.m) force_lambda: Union[list, float] = [0.0] node_disp: Union[list, float] = [0.0] for seg in segs: ok = analysis.StaticAnalyze(node=ctrl_node, dof=2, seg=seg) # node tag 1, dof 2 if ok < 0: raise RuntimeError("Analysis failed") # noqa: TRY003 # Fetch response ODB.fetch_response_step() force_lambda.append(ops.getLoadFactor(patternTag)) node_disp.append(ops.nodeDisp(ctrl_node, 2)) return np.array(node_disp), np.array(force_lambda) ``` -------------------------------- ### Configure zeroLength and zeroLengthSection Elements Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-ele-removal-add.html This configuration handles cases where both the top and base are free, setting up both zeroLength and zeroLengthSection elements. It involves creating nodes for both, defining the main and left elements, and then the zero-length elements. ```python print("CASE: zeroLength & zeroLengthSection") ops.node(nodeTag_top_link, 0.0, 0.0, 1.2 * UNIT.m) # For top zeroLength ops.node(nodeTag_base_link, 0.0, 0.0, 0.2 * UNIT.m) # For base zeroLengthSection ops.element( "dispBeamColumn", eleTag_main, *(nodeTag_top, nodeTag_base_link), transf_ver, npTag_1, ) # Single vertical element ops.element( "dispBeamColumn", eleTag_left, *(nodeTag_top, nodeTag_left_base), transf_ver, npTag_2, ) # Left oblique element mats = (elasticTag, elasticTag, elasticTag, elasticTag, elasticTag, elasticTag) ops.element( "zeroLength", eleTag_top_link, *(nodeTag_top_link, nodeTag_top), "-mat", *mats, "-dir", *(1, 2, 3, 4, 5, 6), "-orient", *(0, 0, -1), *(0, -1, 0), ) ops.equalDOF(*(nodeTag_base, nodeTag_base_link), *(1, 2, 3)) ops.element( "zeroLengthSection", eleTag_base_link, *(nodeTag_base_link, nodeTag_base), secTag_2, "-orient", *(0, 0, -1), *(0, -1, 0), ) return_val = RETURN_VAL( ctrl_node=nodeTag_top_link, remove_ele=eleTag_left, add_ele=( "dispBeamColumn", eleTag_right, *(nodeTag_top, nodeTag_right_base), transf_ver, npTag_2, ), top_link_ele=eleTag_top_link, base_link_ele=eleTag_base_link, ) ``` -------------------------------- ### Configure Pushover Animation Parameters Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-MRF-2Story-Concentrated-PanelZone.html Sets animation properties such as interpolation, scaling, and output file format. Ensure the output filename extension matches the desired format for compatibility. ```python interpolate_beam_disp=True, defo_scale=2.0, framerate=30, savefig="pushover_disp_animation.mp4", # mp4 more efficient but gif more widely supported ).close() ``` -------------------------------- ### Create Output Database (ODB) Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-excavation.html Initializes the ODB object for saving analysis results. Set model_update=True if elements/nodes will be removed. save_every controls the frequency of saving, and compute_mechanical_measures enables calculation of derived quantities. ```python ODB = opst.post.CreateODB( odb_tag=1, model_update=True, save_every=8, # every 8 analysis steps will be saved compute_mechanical_measures=True, project_gauss_to_nodes="copy", ) ``` -------------------------------- ### Import Dependencies Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-double-layer-shallow-dome.html Initial imports for numerical computation, plotting, and OpenSees integration. ```python import matplotlib.pyplot as plt import numpy as np import openseespy.opensees as ops import opstool as opst import opstool.vis.plotly as opsvis # import opstool.vis.pyvista as opsvis ``` -------------------------------- ### Initialize triangle structure Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-ele-removal-add.html Creates a triangle structure model with optional top and base link elements using OpenSees commands. ```python def triangleStruc(top_free: bool = False, base_free: bool = False, info: bool = True) -> RETURN_VAL: """ # Create a simple triangle structure :param top_free: if True, add zeroLength element to the top :param base_free: if True, add zeroLengthSection element to the base :param info: if True, print section element information :return a namedtuple with the following values: - :ctrl_node: the control node for static analysis - :remove_ele: the element to be removed - :add_ele: the element to be added - :top_link_ele: the top zeroLength element - :base_link_ele: the base zeroLengthSection element """ "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" # Initialize ops.wipe() ops.model("basic", "-ndm", 3, "-ndf", 6) # For vertical element transf_ver = 1 ops.geomTransf("PDelta", transf_ver, *(-1, 0, 0)) # For other element transf_other = 2 ops.geomTransf("PDelta", transf_other, *(0, 0, 1)) "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" # Steel material steelTag = 10 ops.uniaxialMaterial("Steel02", steelTag, 400 * UNIT.mpa, 206 * UNIT.gpa, 0.01) # Elastic no tension material ENTTag = 20 ops.uniaxialMaterial("ENT", ENTTag, 200 * UNIT.gpa) # Elastic material elasticTag = 30 ops.uniaxialMaterial("Elastic", elasticTag, 1.0e6) "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" # Define vertical element section secTag_1 = 1 W_1 = 10.0 * UNIT.cm H_1 = 10.0 * UNIT.cm sec_props_1 = secCreate(sec_name="vertical", secTag=secTag_1, matTag=steelTag, w=W_1, h=H_1, info=info) # Define vertical base link element section secTag_2 = 2 sec_props_2 = secCreate( sec_name="vertical base", secTag=secTag_2, matTag=ENTTag, w=W_1, h=H_1, info=info, ) # Define other element section secTag_3 = 3 W_2 = 2.0 * UNIT.cm H_2 = 2.0 * UNIT.cm sec_props_3 = secCreate(sec_name="oblique", secTag=secTag_3, matTag=steelTag, w=W_2, h=H_2, info=info) "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" # Node Tags nodeTag_base = 1 nodeTag_top = 2 nodeTag_base_link = 3 # Base link node nodeTag_top_link = 4 # Top link node nodeTag_left_base = 5 nodeTag_right_base = 6 # Element Tags eleTag_main = 1 eleTag_left = 2 eleTag_right = 3 eleTag_base_link = 4 # Base link element eleTag_top_link = 5 # Top link element "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" # Create nodes ops.node(nodeTag_base, 0.0, 0.0, 0.0) ops.node(nodeTag_top, 0.0, 0.0, 1.0 * UNIT.m) ops.node(nodeTag_left_base, 0.0, -1.0 * UNIT.m, 0.0) ops.node(nodeTag_right_base, 0.0, 1.0 * UNIT.m, 0.0) # Nodes fix ops.fix(nodeTag_base, 1, 1, 1, 1, 1, 1) ops.fix(nodeTag_left_base, 1, 1, 1, 1, 1, 1) ops.fix(nodeTag_right_base, 1, 1, 1, 1, 1, 1) # Integration npTag_1 = 1 npTag_2 = 2 ops.beamIntegration("Legendre", npTag_1, secTag_1, 5) ops.beamIntegration("Legendre", npTag_2, secTag_3, 5) "# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----" """ Note: In order to check the local axes of zeroLength and zeroLengthSection, the length of zeroLength and zeroLengthSection elements is not zero. It causes opensees warning but does not affect the results. """ if top_free and not base_free: print("CASE: zeroLength") ops.node(nodeTag_top_link, 0.0, 0.0, 1.2 * UNIT.m) # For top zeroLength ops.element( "dispBeamColumn", eleTag_main, *(nodeTag_top, nodeTag_base), transf_ver, npTag_1, ) # Single vertical element ops.element( "dispBeamColumn", eleTag_left, *(nodeTag_top, nodeTag_left_base), transf_ver, npTag_2, ) # Left oblique element mats = (elasticTag, elasticTag, elasticTag, elasticTag, elasticTag, elasticTag) ops.element( "zeroLength", eleTag_top_link, *(nodeTag_top_link, nodeTag_top), "-mat", *mats, "-dir", *(1, 2, 3, 4, 5, 6), "-orient", *(0, 0, -1), *(0, -1, 0), ) ``` -------------------------------- ### Import openseespy library Source: https://opstool-doc.readthedocs.io/en/latest/_sphinx_gallery_examples/examples/postprocessing/ex-excavation.html Imports the necessary openseespy library for finite element analysis. ```python import openseespy.opensees as ops ```