adtzlr / trusspy

Nonlinear Truss Solver for Python
http://trusspy.readthedocs.io/
GNU General Public License v3.0
53 stars 11 forks source link

time.clock() error in Python 3.8 #10

Closed Giannis1993 closed 4 years ago

Giannis1993 commented 4 years ago

Solution is to replace time.clock() according to the following link:

https://stackoverflow.com/questions/58569361/attributeerror-module-time-has-no-attribute-clock-in-python-3-8

Also, it would be nice if you could get the stiffness matrix as a function of the areas of the elements for optimization purposes!

adtzlr commented 4 years ago

First part: Done. Pushed a new build to PyPi. Please update via pip.

adtzlr commented 4 years ago

For the second part: Could you explain your idea in detail? Do you mean something like

def stiffness(list_of_element_areas):
    #code for stiffness matrix
    return KT

How would you like to have this implemented? I mean TrussPy is meant for nonlinear deformation analysis of truss structures. So the stiffness matrix changes in EVERY increment. Would you like to access the stiffness matrix for every increment AFTER the job has completed? For example something like

M.Results.R[10].KT(list_of_element_areas)

for the 10-th increment?

Actually I'm not really sure if this makes sense in the nonlinear case at all. This kind of optimization seems more useful for the geometric linear case with small nodal displacements (and constant stiffness matrix) for me - please correct me if I'm wrong.

Giannis1993 commented 4 years ago

Truss problems are used a lot in structural optimization as benchmark problems. Most people who work in that framework use Python, so I think it would be very useful for this community. What I meant exactly is the following:

When you want to optimize a truss, you usually use as design variables the cross sectional areas of the truss elements. Therefore, getting the stiffness matrix as a function of the design variables (either like you said, or just by allowing symbolic variables for ‘area’ in your code) would be very useful.

Another thing I tried to do but wasn’t able to is to get the initial stiffness matrix (undeformed configuration. So let’s say I build my model, then I can’t access the initial stiffness matrix unless I pause the M.run() when the first step is finished. Most people who use the code are looking for the undeformed initial stiffness matrix.

By the way, you have done an amazing job!

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Andreas D.mailto:notifications@github.com Sent: Friday, April 10, 2020 14:37 To: adtzlr/trusspymailto:trusspy@noreply.github.com Cc: Giannis1993mailto:yianpass@hotmail.com; Authormailto:author@noreply.github.com Subject: Re: [adtzlr/trusspy] time.clock() error in Python 3.8 (#10)

For the second part: Could you explain your idea in detail? Do you mean something like

def stiffness(list_of_element_areas):

#code for stiffness matrix

return KT

How would you like to have this implemented? I mean TrussPy is meant for nonlinear deformation analysis of truss structures. So the stiffness matrix changes in EVERY increment. Would you like to access the stiffness matrix for every increment AFTER the job has completed? For example something like M.Results.R[10].KT(list_of_element_areas)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/adtzlr/trusspy/issues/10#issuecomment-612010849, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AN6QJEW3W73KOWNHBKYUT4DRL4HGTANCNFSM4MEWRAGQ.

adtzlr commented 4 years ago

I'll close this issue and created #13 for the second part as the title of this issue was already solved.