Code Monkey home page Code Monkey logo

python_stable_3d_truss_analysis's Introduction

slientruss3d : Python for stable truss analysis and deep learning research

Python Version GitHub release Downloads_Week Downloads_Day License


Description

slientruss3d is a python package which can solve the resistances, internal forces and joint dispalcements in a stable 2D or 3D truss by direct stiffness method. And also can do truss optimization by Genetic Algorithm (GA), generate truss data and work with pytorch-geometric conveniencely.

This repo is writen by :

Taiwan                                          (臺灣)
Department of Civil Engineering                 (土木工程學系)
National Yang Ming Chiao Tung University (NYCU) (國立陽明交通大學)
Shih-Chi Cheng                                  (鄭適其)

Show

Content

  1. Installaltion
  2. Quick start
  3. Combine with JSON
  4. Plot your truss
  5. Truss optimization
  6. Generate truss data automatically
  7. Convert Truss to Pytorch-Geometric HeteroData

Install

First, check your python version:

Python must >= 3.9.7

Second, download the slientruss3d package:

pip install slientruss3d 

Time consuming

The following are time consuming tests for doing structural analysis for each truss (Each testing runs for 30 times and takes average !).

  • 6-bar truss   : 0.00037(s)
  • 10-bar truss  : 0.00050(s)
  • 25-bar truss  : 0.00126(s)
  • 47-bar truss  : 0.00253(s)
  • 72-bar truss  : 0.00323(s)
  • 120-bar truss : 0.00557(s)
  • 942-bar truss : 0.05253(s)

Testing on :

CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
RAM: 8GB DDR4 * 2

Update log

New feature in v2.0.0 update !

  • Important API adjustment : We simplified the JSON format in slientruss3d, see the details in Format of JSON. You can use the v1_to_v2.py module in the root folder to convert the old JSON format to the new one rapidly.

  • Data Augmentation : You can use some new method in slientruss3d.generate module to do data augmentation to generated cube-like trusses ! See more details in Data Augmentation. For example:

drawing drawing

drawing

An important API adjustment after v1.3.25 !

After slientruss3d v1.3.25, the method Truss.Solve() will return None instead of the result of structural analysis. If you want to get the result of structural analysis, please use other getters defined in Truss object such as:

# Get result of structural analysis:
displace, stress, resistance = truss.GetDisplacements(), truss.GetInternalStresses(), truss.GetResistances()
return displace, stress, resistance

New feature in v1.3.0 update !

After slientruss3d v1.3.0, you can use slientruss3d.generate module to generate truss data automatically. For now, only simple cube-like truss can be generated by slientruss3d, but I think this is still a helpful way for anyone who suffers from lake of truss data.

More details are in Generate truss data automatically

ShowCube

New feature in v1.2.0 update !

After slientruss3d v1.2.0, you could use slientruss3d.ga module to do member type selection optimization conveniencely with Genetic Algorithm (GA)! Just simply define the topology of the truss and what member types you want to use, and then you could start the optimization.

More details are in Truss optimization

Besides GA, there are some new useful methods in the Truss object:

class Truss:

    ...

    # Check whether all internal forces are in allowable range or not:
    def IsInternalStressAllowed(self, limit, isGetSumViolation=False) -> tuple[bool, dict | float]: 
        ...

    # Check whether all internal displacements are in allowable range or not:
    def IsDisplacementAllowed(self, limit, isGetSumViolation=False) -> tuple[bool, dict | float]:
        ...

Enjoy 😎 !

python_stable_3d_truss_analysis's People

Contributors

leo27945875 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python_stable_3d_truss_analysis's Issues

AttributeError: 'Arrow3D' object has no attribute 'do_3d_projection' when running example.py

Hello,
when running the example.py with the current stable matplotlib==3.5.2, I get this error: AttributeError: 'Arrow3D' object has no attribute 'do_3d_projection',

It works with matplotlib==3.4 though.

Results when running "python3 example.py":
numCube : 4, i : 1Traceback (most recent call last):
File "/home/dave/Python_Stable_3D_Truss_Analysis/example.py", line 236, in
TestGenerateCubeTruss()
File "/home/dave/Python_Stable_3D_Truss_Analysis/example.py", line 218, in TestGenerateCubeTruss
trussList = GenerateRandomCubeTrusses(gridRange=GRID_RANGE,
File "/home/dave/Python_Stable_3D_Truss_Analysis/slientruss3d/generate.py", line 324, in GenerateRandomCubeTrusses
TrussPlotter(truss,
File "/home/dave/Python_Stable_3D_Truss_Analysis/slientruss3d/plot.py", line 125, in Plot
plt.savefig(savePath)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 958, in savefig
res = fig.savefig(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 3019, in savefig
self.canvas.print_figure(fname, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 2319, in print_figure
result = print_method(
File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 1648, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/_api/deprecation.py", line 412, in wrapper
return func(*inner_args, **inner_kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 540, in print_png
FigureCanvasAgg.draw(self)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 436, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 73, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 2810, in draw
mimage._draw_list_compositing_images(
File "/usr/lib/python3/dist-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 451, in draw
for artist in sorted(collections_and_patches,
File "/usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 426, in do_3d_projection
signature = inspect.signature(artist.do_3d_projection)
AttributeError: 'Arrow3D' object has no attribute 'do_3d_projection'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.