Truss Element Responses (Plotly)¶
[1]:
import openseespy.opensees as ops
import opstool as opst
import opstool.vis.plotly as opsvis
[2]:
opst.load_ops_examples("TrussBridge") # or your model code here
# add loads
ops.timeSeries("Linear", 1)
ops.pattern("Plain", 1, 1)
ops.load(3, 0.0, 0.0, -15000.0)
ops.load(4, 0.0, 0.0, -15000.0)
ops.load(5, 0.0, 0.0, -15000.0)
ops.load(6, 0.0, 0.0, -15000.0)
ops.load(7, 0.0, 0.0, -15000.0)
ops.load(8, 0.0, 0.0, -15000.0)
ops.load(17, 0.0, 0.0, -15000.0)
ops.load(18, 0.0, 0.0, -15000.0)
ops.load(19, 0.0, 0.0, -15000.0)
ops.load(20, 0.0, 0.0, -15000.0)
[3]:
fig = opsvis.plot_model(show_nodal_loads=True)
# fig.show(renderer="jupyterlab")
# fig.show(renderer="notebook")
# fig.show(renderer="browser")
# fig.show() # for auto
# fig.write_html("**.html")
[5]:
# ------------------------------
# Start of analysis generation
# ------------------------------
# create SOE
Nsteps = 10
ops.system("ProfileSPD")
# create DOF number
ops.numberer("Plain")
# create constraint handler
ops.constraints("Plain")
# create integrator
ops.integrator("LoadControl", 1.0 / Nsteps)
# create algorithm
ops.algorithm("Newton")
# create test
ops.test("NormUnbalance", 1e-8, 10)
# create analysis object
ops.analysis("Static")
[6]:
ODB = opst.post.CreateODB(odb_tag=1)
for _ in range(Nsteps):
ops.analyze(1)
ODB.fetch_response_step()
ODB.save_response()
OPSTOOL :: All responses data with _odb_tag = 1 saved in .opstool.output/RespStepData-1.nc!
[7]:
opsvis.set_plot_props(point_size=0)
opsvis.set_plot_colors(truss="gray", cmap="plasma")
fig = opsvis.plot_truss_responses(
odb_tag=1,
resp_type="axialForce",
slides=False,
step="absMax",
alpha=2.0,
line_width=4,
unit_symbol="N",
style="wireframe",
color="blue",
opacity=0.75,
show_bc=True,
bc_scale=1.5,
)
# fig.show(renderer="jupyterlab")
# fig.show(renderer="notebook")
# fig.show(renderer="browser")
fig.show() # for auto
# fig.write_html("**.html")
OPSTOOL :: Loading response data from .opstool.output/RespStepData-1.nc ...
Data type cannot be displayed: application/vnd.plotly.v1+json
[9]:
fig = opsvis.plot_truss_responses(
odb_tag=1,
resp_type="axialForce",
slides=True,
alpha=2.0,
line_width=4,
unit_symbol="kN",
unit_factor=1e-3,
style="wireframe",
color=None,
show_bc=True,
bc_scale=1.5,
)
fig.show() # for auto
fig.write_html("images/truss_resp_plotly2.html", full_html=False, include_plotlyjs="cdn")
OPSTOOL :: Loading response data from .opstool.output/RespStepData-1.nc ...
Data type cannot be displayed: application/vnd.plotly.v1+json