jwock82 / pynite Goto Github PK
View Code? Open in Web Editor NEWA 3D structural engineering finite element library for Python.
License: MIT License
A 3D structural engineering finite element library for Python.
License: MIT License
I've introduced in PyNiteFEA the possibilty to orient local referring system by means auxiliary nodes. Formulation on transformation matrix is changed too. Also I've introduced in Visualization.py another function in order to view the deformed configuration of the model using the deformed nodes coordinates connected by straight line. Now I m working to view the real deflection of every elements.
How can I added these changes to the online code?
I'm using PyNiteFEA for my master's degree thesis. Using PyNiteFEA I think that a way to oriented y and z local axis si needed. I have to control how local system is oriented becasue in a complicated 3D model could be difficult understand all local referring systems that are defined by PyNite.
My idea is to use auxiliar points. It is possible to implement in PyNiteFEA?
What do i need for implementing 3d elements like bricks or prisma and connect them to truss elements?
When i execute Simple Beam - Point Load.py file. This error came. How to resolve this issue.
I```
NFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Users\cparlapalle\AppData\Local\Programs\Python\Python38\lib\site-packages\pdfkit\configuration.py", line 21, in init
with open(self.wkhtmltopdf) as f:
FileNotFoundError: [Errno 2] No such file or directory: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/pynitefem/simplebeam_pointload.py", line 60, in
Reporting.CreateReport(SimpleBeam, output_filepath='.//PyNite Report.pdf', plates=False, plate_corner_forces=False,
File "E:\pynitefem\PyNite\Reporting.py", line 36, in CreateReport
pdfkit.from_string(HTML, output_filepath, css='.//PyNite//MainStyleSheet.css')
File "C:\Users\cparlapalle\AppData\Local\Programs\Python\Python38\lib\site-packages\pdfkit\api.py", line 69, in from_string
r = PDFKit(input, 'string', options=options, toc=toc, cover=cover, css=css,
File "C:\Users\cparlapalle\AppData\Local\Programs\Python\Python38\lib\site-packages\pdfkit\pdfkit.py", line 42, in init
self.configuration = (Configuration() if configuration is None
File "C:\Users\cparlapalle\AppData\Local\Programs\Python\Python38\lib\site-packages\pdfkit\configuration.py", line 24, in init
raise IOError('No wkhtmltopdf executable found: "%s"\n'
OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
Process finished with exit code 1
Does the current PyNite module support following features?
Describe the bug
I ran one of the testing and debugging files with the visualisation vtk module. However, when run in terminal, the window does not show anything. There are just errors. The printed lines do work however and they give me the correct results.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Some sort of visualisation?
My reactions appear to be incorrect. I'm adding this as a known issue to alert anyone using the program. I discovered it as I was working on a "statics check" feature. This is a high priority item I plan to resolve as soon as possible.
Dear JWock82,
I am studying master in civil engineering. I am related to code so I want to help your code. Could you communicate with me? [email protected]
Bug deflection with distributed and concentrated load in local y direction
PyNite returns wrong deflection when distributed load "Fy" and concentrated load "Fy" are applied at the same time on an element. In case of simple supported beam, the result is the following:
CODE
from PyNite import FEModel3D
from PyNite import Visualization_polilinea
Beam = FEModel3D()
L=5 #m
Beam.AddNode("N1", 0, 0, 0)
Beam.AddNode("N2", L, 0, 0)
Beam.AddAuxNode("A1",0,0,L)
E=2.1e11 #N/m^2
G=1.5e11
Iy=0.001125 #m^4
Iz=0.003125 #m^4
J=1
A=0.15 #m^2
Beam.AddMember("M1", "N1", "N2",E,G,Iy,Iz,J,A,"A1")
Beam.DefineSupport("N1",True, True, True, True, False, False)
Beam.DefineSupport("N2",True, True, True, False, False, False)
Beam.AddMemberPtLoad("M1","Fy",-20000,L/2)
Beam.AddMemberDistLoad("M1","Fy", -8000,-8000)
Beam.Analyze()
Beam.GetMember("M1").PlotDeflection("dy")
I found a problem during an exemple test of new PyNite. There is a problem in a simple supported beam with a concentrated force acting in local y direction. The problem is about deflection.
##Units N e m
##Import FEModel3D
from PyNite
from PyNite import FEModel3D
from PyNite import Visualization
##Create a new finite element model
SimpleBeam = FEModel3D()
L=5 #m
##Nodes
SimpleBeam.AddNode("N1", 0, 0, 0)
SimpleBeam.AddNode("N2", L, 0, 0)
SimpleBeam.AddAuxNode("aN1",0,0,L/2)
##Beam (30x50 cm)
E=2.1e11 #N/m^2
G=1
Iy=0.001125 #m^4
Iz=0.003125 #m^4
J=1
A=0.15 #m^2
SimpleBeam.AddMember("M1", "N1", "N2",E,G,Iy,Iz,J,A,"aN1")
##Supports
SimpleBeam.DefineSupport("N1",True, True, True, True, False, False)
SimpleBeam.DefineSupport("N2",True, True, True, True, False, False)
view=Visualization.RenderModel(SimpleBeam,0.2)
##Loads
SimpleBeam.AddMemberPtLoad("M1","Fy",2000,L/2)#N e m
#SimpleBeam.AddMemberDistLoad("M1","Fy",10,10,2,3)
##Analysis
SimpleBeam.Analyze()
##Diagrams V,M and displacements
SimpleBeam.GetMember("M1").PlotDeflection("dy")
SimpleBeam.GetMember("M1").PlotShear("Fy")
SimpleBeam.GetMember("M1").PlotMoment("Mz")
SimpleBeam.GetMember("M1").PlotAxial()
I think there is a problem with D function in FEModel3D.py. If the starting idea was to return global displacement vector of the model, then there is a bug. Now this function returns only a part of D.
If it is so, we would have to correct it.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Hi Craig,
I am trying to model the below problem as part of my digital tool development. I wanted to understand how I can model a hinge in a beam. PyNite solves the problem when there is no hinge but as soon as I introduce hinge, it is failing with "Matrix is exactly singular" warning.
See the code for the above problem below. I did increase the member length by a factor of 10 to improve the visualization. I tried a few options but no luck so far. Am I missing something?
from PyNite import FEModel3D
SimpleBeam = FEModel3D()
SimpleBeam.AddNode('A', 0, 0, 0)
SimpleBeam.AddNode('B', 50, 0, 0)
SimpleBeam.AddNode('C', 80, 0, 0)
SimpleBeam.AddNode('F', 140, 0, 0)
SimpleBeam.AddMember('AB', 'A', 'B', 29000, 11400, 100, 150, 250, 20)
SimpleBeam.AddMember('BC', 'B', 'C', 29000, 11400, 100, 150, 250, 20)
SimpleBeam.AddMember('CF', 'C', 'F', 29000, 11400, 100, 150, 250, 20)
SimpleBeam.DefineSupport('A', True, True, True, True, False, False)
SimpleBeam.DefineSupport('C', True, True, True, False, False, False)
SimpleBeam.DefineSupport('F', True, True, True, False, False, False)
SimpleBeam.DefineReleases('AB', False, False, False, False, False, False,
False, False, False, False, False, True) #Relesing moments in z plane at B end of AB
SimpleBeam.DefineReleases('BC', False, False, False, False, False, True,
False, False, False, False, False, False) #Relesing moments in z plane at B end of BC
SimpleBeam.AddMemberDistLoad('AB', 'Fy', -0.01, -24, 0, 50)
SimpleBeam.AddMemberPtLoad('CF', 'Fy', -45, 20)
SimpleBeam.AddMemberPtLoad('CF', 'Fy', -60, 40)
SimpleBeam.Analyze()
SimpleBeam.GetMember('AB').PlotMoment('Mz')
SimpleBeam.GetMember('BC').PlotMoment('Mz')
SimpleBeam.GetMember('CF').PlotMoment('Mz')
from PyNite import Visualization
Visualization.RenderModel(SimpleBeam, text_height=5, deformed_shape=False, deformed_scale=100, render_loads=True)`
Regards
Lino
Describe the bug
When installing pynite using the Pipenv file, you get errors when trying to import the package.
The problem appears to be that pip installs the package to ...\site-packages\pynite, but the package's init file contains the line:
from PyNite.FEModel3D import FEModel3D
This appears to be a case sensitivity issue - is the package intended for Linus use only?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The ability to import elements of pynite
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Describe the bug
Hi..thank you for your brilliant work. I have been working on creating a website to do structural analysis using PyNite (www.standardsolver.com). I came across this error. I checked whether it is something on my end but no luck. I also modified the example file and manage to reproduce the same error.
The error is regarding the support reactions.
To Reproduce
Steps to reproduce the behavior:
So for a simply supported beam 5m long with a moment of 10kNm at the midpoint. I am getting a Fy support reaction of 2kN on the left side and 0.5kN on the right side.
Expected behavior
I was expecting +2kN on left and -2kN on right.
Screenshots
If applicable, add screenshots to help explain your problem.
The below is the screenshot from program i made using PyNite:
Screenshot of modified example file:
Additional context
For other load scenarios such as point loads and udls I haven't noticed any error.
Version I am using is PyNiteFEA==0.0.21
I'm not sure about member's local referring system and about sign to use to applicate member's loads. I read in FEModel3D.py that :
But, in FixedEndReactions.py, about PtLoad, If I apply a load P in "Fy" direction at x=L/2 I obtain following fixed reactions:
Fyi= P/2
Fyj= P/2
Mzi= PL/8
Mzj= -PL/8
If load P is downwards, reactions Fyi and Fyj will be upwards and they would be opposite in sign.
So, which is the correct way to understand how to applicate loads and then read results?
I'm using PyNite for my master thesis and togheter with my professor we are modeling a girder bridge in order to perform linear elastic analysis and use them togheter with a monitoring system installed on the bridge. This rappresents the start of a big project. If you are agree with me, I think is correct mention you in my thesis work.
I'm nearly done implementing load combinations. The code is written and so far seems to be stable. I'm going to run some more tests on it this week. Load combinations will roll out soon after, and then I'll add documentation for this feature!
Hi Graig,
Hope you are doing well and hope you remember me. I have released the standardsolver beam analysis and it is getting some good reviews. It is not very popular yet but I am spreading the message. Got some good reviews in Reddit.
https://www.reddit.com/r/StructuralEngineering/comments/kgyzcr/free_beam_analysis_software/
I am now working on building a similar calculation for 2D frame analysis.
I have a feature request if it is possible.
For nodal supports, they can be only aligned in global X, Y. Is there a way to specify an angle to them with respect to the global axis, For example, if you want to apply only lateral restrain to an inclined member and allow the member to move axially free, At present, it seems it is not possible from reading the wiki.
Regards
Lino
Description:
The calculated values for the moment and deflection do not match the expected values printed at the end.
To Reproduce:
Steps to reproduce the behavior:
Testing & Debuging/AISC 2nd Order Benchmark Check.py
Output Displayed:
PyNite Calculated Moment: -99.99499999998429
PyNite Calculated Displacement: 7.944827586205967
AISC Benchmark Problem Moment: 435.6165910296658
AISC Benchmark Problem Displacement: 40.27399092355989
In order to obtaine 3D deformed shape, I've introduced axial deformation and axial translation in PyNite. I've defined two new functions in BeamSegZ.py:
"Translation1" is defined in Member3D.py forsì SegmentsZ[0] and SegmentsZ[i].
With these new functions, deformed shape of 2D frame shown in pull request Update Visualization.py #30 now it's correct.
There are some problems with axial distributed load (p1 and p2); I think because I have to add other terms (terms that includes p1 and p2) in Axial translation's formula. In this moment, using this formulation, with a simple supported beam with axial distributed load, I otained the follow axial translations:
I've tried to understand formula used in Deflection function in BeamSegZ but I don't remeber how get terms who account for distributed load p1 and p2.
Thaks for supporting!
Member3D.py
I don't unterstand because static condensation is used ( for example to built stiffness matrix, local fixed end reaction vector) and how it works.
Why __fer_Unc() is used in this part of code?
FEModel3D.py
Why fer() is used to assemble the global fixed end reacton vector? In Member3D.py, fer( ) is referred in local refering system. I should use FER () defined in Member3D.py, which is obtained after rotation by means T matrix
I would like to understand an instruction used in python moduls inside PyNiteFEA package. I'm talking about this instruction:
from PyNite.<module_name> import <module_name>
(in _ init _ .py module)
from PyNite.FEModel3D import FEModel3D
(in FEModel3D.py module)
from PyNite.Node3D import Node3D
from PyNite.Member3D import Member3D
from PyNite.Plate3D import Plate3D
(in Member3D.py module)
from PyNite.BeamSegment import BeamSegment
import PyNite.FixedEndReactions
Why these instructions are use instead of "from PyNite import <module_name>"?
Thanks for help me.
Are there any units used for the calculations?
I noticed you were using imperial, but I use metric, so is there anything I need to change in the files, or is it all written without units?
The ability to add a spring support directly to a node rather than creating a new spring element might be helpful to many users.
The DefineSupport function could be setup to somehow take true, false, or a spring stiffness value.
Example: ABCD.DefineSupport('N1', False, True, 1153, True, True, True)
A good example is the skyciv implementation allowing you to add a stiffness for all 6dofs
I've analyzed a simple beam with a constant distributed axial load and with hinges at both nodes. I expected to obtained a linear and symmetric axial stress. This is correct because both nodes are able to react in terms of axial load.
#Units N e m
###Import FEModel3D
from PyNite
from PyNite import FEModel3D
from PyNite import Visualization
###Create a new finite element model
Beam = FEModel3D()
L=5 #m
###Nodes
Beam.AddNode("N1", 0, 0, 0)
Beam.AddNode("N2", L, 0, 0)
###Beams (30x50 cm)
E=2.1e11 #N/m^2
G=1
Iy=0.001125 #m^4
Iz=0.003125 #m^4
J=1
A=0.15 #m^2
Beam.AddMember("M1", "N1", "N2",E,G,Iy,Iz,J,A)
###Supports
Beam.DefineSupport("N1",True, True, True, True, True, True)
Beam.DefineSupport("N2",True, True, True, False, True, True)
view=Visualization.RenderModel(Beam,0.5)
###Load
Beam.AddMemberDistLoad("M1","Fx",10,10,0,5)
#Analyze
Beam.Analyze()
#Diagrams V,M and displacements
Beam.GetMember("M1").PlotAxial()
#Reactions
print("R1=",Beam.GetNode("N1").RxnFX,"N")
print("R2=",Beam.GetNode("N2").RxnFX,"N")
Results obtained are different from thinked ones. Axial diagram starts from 0 and finish to the value of total axial load applicated to the beam. Alse both reactions are zero.
How is possible? Is there any problem in my code? Or is there any problem in PyNite code?
Thanks
I need to modify some fucntions within classes in order to test the program with different examples. I have tried to modify a generic function but I don't see any changing when code is running. How is possible? Do i have to do uninstall and install again?
Thanks for considering my new features. Now i wait to download new PyNite version by means pip.
Also, I have another question: what is module init.py used for?
Waiting for lastes version of PyNIteFEA on PyPi, so that we can continue with develop. Thanks.
It will be usefull if Plate3D element can support non-uniform (trapezodial) loads.
Is there any way to load Plate3D element non-uniformly that i can't see?
The elif
expression on Visualization.py line 828 is identical to the preceding if
expression, meaning that it never runs. This elif
branch is intended to identify a pin-supported Node
and render it as a cone instead of a sphere. As written, any pin-supported Node
is rendered as a sphere as normal, through the else
clause.
The elif
expression should be changed to correspond to a pin-support (e.g. SupportMX = False, ...
, etc), or removed if the cone rendering isn't desired.
PyNite/PyNite/Visualization.py
Line 828 in 6d61dc7
I have a problem with PyNite installation.
First of all I install Pynite by the command "pip install Pynite" in prompt of comand of my computer. Now, if I check the already installed modules by the command "pip list", PyNite is available. The problem is when I want to use PyNite module in a script:
PyNite-master -> Examples -> Simple Beam - Point Load.py -> EDIT with IDLE ->Run module (F5)
How can I solve it?
Hi. First off, PyNite is a great project and i'm very excited to see the pace at which it is improving.
Describe the bug
Quad elements don't seem to produce a valid result if they're skewed from rectangular, but no interpreter errors are raised
To Reproduce
The below code produces a rectangular test grid in order to test out the quad functionality. It seems to work fine when i set the skew to zero (ie. all quads are rectangular), but as soon as the skew is non-zero all of the reactions and displacements become 'nan' and the displacement plot no longer correctly plots the quad displacements.
Apologies as the code runs on my own fork, in which i've added element auto-naming (when 'None' is passed to the constructor function)...
# Import 'FEModel3D' and 'Visualization' from 'PyNite'
from PyNite import FEModel3D
from PyNite import Visualization
# Create a new model
plate_test = FEModel3D()
hplates=10
vplates=20
plate_dim=0.5
skew=0.01
# Create a test model with a grid of quad elements
node_array=[]
plate_array=[]
support_nodes=[]
for yi in range(vplates+1):
y2=(yi+1)*plate_dim
current_row=[]
current_row_plates=[]
for xi in range(hplates+1):
x2=(xi+1)*plate_dim * (1+yi*skew)
current_row.append(plate_test.AddNode(None, x2, y2, 0))
if (xi==2 or (xi>0 and xi % 8==0)) and (yi==2 or (yi>0 and yi % 8 ==0)):
plate_test.DefineSupport(current_row[-1], True, True, True, False, False, False)
support_nodes.append(current_row[-1])
if yi>0 and xi>0:
n1 = node_array[yi-1][xi-1]
n2 = current_row[xi-1]
n3 = current_row[xi]
n4 = node_array[yi-1][xi]
nq=plate_test.AddQuad(None,n1,n2,n3,n4,0.01,2e11,0.25)
plate_test.AddQuadSurfacePressure(nq,1000)
current_row_plates.append(nq)
node_array.append(current_row)
plate_array.append(current_row_plates)
# # Analyze the model
plate_test.Analyze()
#Print critical node reactions
for i,n in enumerate(support_nodes):
print("Node",i,"reaction is",plate_test.GetNode(n).RxnFZ["Combo 1"])
#Print node displacements
i=0
for row in node_array:
for nd in row:
print("Node",i,"displacement is",plate_test.GetNode(nd).DZ["Combo 1"])
i+=1
# # Render the model for viewing.
Visualization.RenderModel(plate_test, text_height=0.05, deformed_scale=0.001, deformed_shape=False, color_map='dz', render_loads=True)
Hi Craig,
Sorry to write this as a feature request. I don't know how to message in github. The beam analysis website powered by pynite is online.
https://www.standardsolver.com/beam-analysis
Please let me know if you have any comments to [email protected].
Regards
Lino
I would like to introduce settlement of a support or, in general, the possibility to choose a nodal displacement. Pratically it rappresents a new load for the model, but it rappresent also a non homogeneus boundary condition.
Could you give me some suggestions (guidelines)?
Description
I have tried to solve a 2D frame example using your code using two software packages in addition to this one. The results obtained using PyNite are different from those obtained using the other two software. I think there is a mistake in the FEM procedure implemented. Please confirm.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When run in the two other softwares the results are different. See MyResults.jpeg
Screenshots
See a screenshot of the PyNite results in PyNiteResults.jpg
Also see the original problem statement I am trying to solve in ProblemStatement.jpeg
Additional context
Please let me know. Kindest regards. Ahmad
Hi, I downloaded the files but I can not make them work. When I run a python file using PyNite module, an error raise telling that there is not module named PyNite. I hope you can help me to install ir right, thanks.
Best regards
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
I would like to add some tests to run against the code base.
The tests would be done using the pytest as the test framework At least initially, the tests would create several different structures and check node reactions and displacements against known values.
The different structures would be examples from structural analysis textbooks, such as R.C. Hibbler's Structural Analysis, to compare the expected results against actual results.
As far as how this would fit into the overall code structure, the tests would be located in a folder called "tests" in the root directory separate from the source code which would look something like this . . .
Hi
Could you plz share the resources you have used in this project. ?
books, papers, etc.
In FEModel3d.py
, the line below (line 231) has a typo in the assignment. The value is assigned to node.EnforceDX
instead of node.EnforcedDx
. This is a silent error that prevents displacements from being applied in the 'DX' direction at all. The error is silent because the assignment still happens, but to the wrong attribute name.
Line 231 in ec049d2
Equivalent nodal forces for concentrated moments were being calculated incorrectly. I've fixed this bug on my local copy and will soon push it the master on GitHub along with the sign convention changes.
I just viewed the image with sign convention of internal actions. And what about external loads?
When all degrees of freedom are supported, there is no stiffness matrix left to invert, and the program crashes. This is only a problem when every degree of freedom is restrained. I'll fix this shortly. Rarely would you ever need to support all DOF's in a model.
Looking to add a AddPlatePressureLoad function to enable plates to receive applied loads.
Perhaps it would have an option to apply loads in the global or local coordinate system. (That may be a useful feature for beam distributed and point loads as well)
I have a question but I don't know if it's due to my lack of understanding. So, you told me that static condensation is used to take into account member releases and build k matrix. Instead of this procedure, can we start from full k matrix and delete rows and coloums releated to released degree of freedom? Would I obtaine the same matrix?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.