sewkokot / opsvis

OpenSeesPy postprocessing and plotting module
GNU General Public License v3.0
35 stars 21 forks source link

plot_mode_shape of model with both elasticElement and truss element #28

Closed BigDevil82 closed 2 years ago

BigDevil82 commented 2 years ago

hello, sir it seems when a model is constructed with both elasticBeamColumn element and truss element, there is some problem when plot the mode shape, as shown by the following snaphsot: the eigen vector has 6 elements, but is assigned to a vector with 3 position. Is it ok to make the situation compatible? thanks

image

sewkokot commented 2 years ago

@BigDevil82 Thank you for spotting this incompatibility. Could you provide a minimal working example, please?

BigDevil82 commented 2 years ago

@sewkokot a simple example is as follows

ops.wipe()
ops.model("basic", "-ndm", 2, "-ndf", 3)

ops.node(1, 0, 0)
ops.node(2, 0, 1)
ops.node(3, 1, 0)
ops.node(4, 1, 1)
ops.node(5, 0.5, 0.5)

ops.fix(1, 1, 1, 1)
ops.fix(3, 1, 1, 1)
ops.fix(5, 1, 0, 1)

ops.geomTransf("Linear", 1)
ops.uniaxialMaterial("Elastic", 1, 210e9)
ops.timeSeries("Linear", 1, "-factor", 1)
ops.pattern("Plain", 1, 1)

ops.element("elasticBeamColumn", 1, 1, 2, 0.04, 30e9, 1.3e-4, 1, "-mass", 1000)
ops.element("elasticBeamColumn", 2, 3, 4, 0.04, 30e9, 1.3e-4, 1, "-mass", 1000)
ops.element("elasticBeamColumn", 3, 2, 4, 0.04, 30e9, 1.3e-4, 1, "-mass", 1000)
ops.element("truss", 5, 5, 2, 0.04, 1)
ops.element("truss", 6, 5, 4, 0.04, 1)

eigenValues = ops.eigen(1)
opsv.plot_mode_shape(1)
plt.show()

Plus, there is another issue that I'm not sure if it's opsv's bug, that is, if I don't do analysis, I can't plot the model. when using opsv.plot_model() before execute the following codes, it will throw a exception at model.py file, line 410, ops.nodeDOFs(node_tag), with a warning "nodeDOFs DOF group null". May you please check it also? thank you so much.

ops.integrator("LoadControl", DGravity)  # determine the next time step for an analysis
# renumber dof's to minimize band-width (optimization), if you want to
ops.numberer("Plain")
ops.system("SuperLU")  # how to store and solve the system of equations in the analysis
ops.constraints("Plain")  # how it handles boundary conditions
# determine if convergence has been achieved at the end of an iteration step
ops.test("NormDispIncr", Tol, 6)
# use Newton's solution algorithm: updates tangent stiffness at every iteration
ops.algorithm("Newton")
ops.analysis("Static")  # define type of analysis static or transient
ops.analyze(10)  # apply gravity
sewkokot commented 2 years ago

@BigDevil82 Thank you for the example. Hopefully I have fixed this bug. Update the opsvis pip package and test it.

For the second issue, it will be fixed in the next OpenSeesPy release. For now to use the plot_model command before doing the analysis is possible with plot_model(node_supports=False), but the node supports will not be plotted. The next OpenSeesPy release will have necessary commands to avoid the ops.nodeDOFs command which gives meaningful data only after the analyze command is run. Then in the opsvis I will use a different approach to show supports in the plot_model.

BigDevil82 commented 2 years ago

@sewkokot Thank you, got it