sewkokot / opsvis

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

Edge case in plotting deformations #14

Open ccaprani opened 2 years ago

ccaprani commented 2 years ago

Hi @sewkokot !

I'm using opsvis as the back end visualization for https://github.com/ccaprani/ospgrid . A grid is a plane 3D structure, and some grids only experience joint rotation without translation, e.g.: image

Manually setting the scale to 1000 gives the very nice: image

However, the automatic scale finding only parses joint translations, and so without manually setting the scale factor we end up with an inf scale factor. It seems that the automatic scale factor calculation in https://github.com/sewkokot/opsvis/blob/864e63729fc424b876ba51fa96fc9f24ed2ab3cc/src/opsvis/opsvis.py#L1897 should actually parse the member interpolated displacements too. If the code in the loop starting https://github.com/sewkokot/opsvis/blob/864e63729fc424b876ba51fa96fc9f24ed2ab3cc/src/opsvis/opsvis.py#L1512 was extracted to a function, this might work easily.

Anyway, MWE using ospgrid you can run:

import ospgrid as ospg
import ospvis as ospv
gs = "AY-5:0,BN0:0,CY5:0,DF0:-5,EF0:5_B0:-50:0_AB,BC,DB,BE" 
grid = ospg.make_grid(gs)
grid.analyze()
ospv.plot_defo(sfac=False, endDispFlag=1)

I'm happy to give this a go, but since it's going to bash around your code architecture to solve, I'd prefer to ask your thoughts first.

sewkokot commented 2 years ago

@ccaprani Thank you for this feature request. Hopefully I have implemented this feature in the updated PyPi version. Please test and let me know if it works.

Anyway I'm preparing a larger refactored version of opsvis. However, after the source files reorganization, the readthedocs documentation generation does not work, so as soon as I solve this issue I will upload the refactored package with new features (e.g. stress plots of 3d elements using pyvista and paraview). More details will come soon.