u-anurag / OpenSeesPy

OpenSeesPy-Visualization: This branch is to work on Plotting commands to Python-based visualization of OpenSees models.
https://openseespydoc.readthedocs.io/en/latest/src/Plotting_Development_Guide.html
5 stars 2 forks source link

Streamline plotting from the model and ODB #5

Closed u-anurag closed 4 years ago

u-anurag commented 4 years ago

A procedure to use plot_model() and plot_modeshape() commands without and with an ODB. The commands should be able to function within the script as well as by reading output from the output database.

cslotboom commented 4 years ago

I suppose there would be two approaches. One possibility is to use key word arguments to turn on or off reading from a file. I use keywords in my functions, but something I don't like is you can end up with passing a lot of arguments to the functions, which looks messy.

i.e. plot_model(Read_From_File = True)

The other possibility would be to use different functions, i.e. plot_model_file()

u-anurag commented 4 years ago

That sounds like a good approach. I was thinking about first trying to read the ODB and use try & except function. for example,

try: nodeList = np.loadtxt(ODB_folder/nodeList.out) except: nodeList = getNodeTags()

This way, we don't have to introduce another argument. plot_model() command currently has two optional arguments, 'nodes' and 'elements' to enable users to print the node and element tags only if they want. Although introducing the ODB argument in the command can be useful. Let's go with the plot_model(Read_From_File = True) or plot_model(ODB).

u-anurag commented 4 years ago

Add new tasks in the Project (https://github.com/u-anurag/OpenSeesPy/projects/1) and convert them into an issue by clicking on the three dots on the upper right corner.

cslotboom commented 4 years ago

So I'll have a version of this up shortly.

@u-anurag I'd like to get input on one thing. Before we would get our node coordinants using OpenSeesPy's function "nodeCoord", e.g.

iNode = ops.nodeCoord(Nodes[0])
jNode = ops.nodeCoord(Nodes[1])

However, if we read from the database, we might not have an active model. I propose using a dictionary to map the node label to the input xyz coordinats. This dictionary would function like a " nodeCoord " command, notably

ops.nodeCoord(nodeID) = [x, y, z]
node_xyz_labels[nodeID] = [x, y, z]

We could define it using the input node command:


    node_xyz_labels = {}
    for jj in range(Nnode):
        node_xyz_labels[int(nodeList[jj])] = [*nodes[jj, :] ]  

Let me know if that sounds okay. Also let me know if you have a preference for the node dictionary, above it's called "node_xyz_labels"

u-anurag commented 4 years ago

If you haven't gone far this route, I would say that leave this function to me. I was working on some plotting things for my research and implemented this thing 1 hour ago in my local repo. You can keep your focus on animations. Sorry, I should have given you heads up.

cslotboom commented 4 years ago

Sure I'm happy to leave things to you for now.

u-anurag commented 4 years ago

30 achieves that.