Solving Beam Bending with SymPy
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
- kkremitzki
- Veteran
- Posts: 2511
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Solving Beam Bending with SymPy
If you've ever had to hand-draw a shear & moment diagram, you'll love this:
https://docs.sympy.org/dev/modules/phys ... blems.html
https://docs.sympy.org/dev/modules/phys ... blems.html
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Solving Beam Bending with SymPy
+1
its worth to embed sympy. there are other nice tools too.
its worth to embed sympy. there are other nice tools too.
Re: Solving Beam Bending with SymPy
No need to embed anything if freecad stays more closely to the python ecosystem...(conda, pip)
Re: Solving Beam Bending with SymPy
Wow!
Source Code. (installed SymPy before used)
Source Code. (installed SymPy before used)
Code: Select all
from sympy.physics.continuum_mechanics.beam import Beam
from sympy import symbols
E, I = symbols('E, I')
R1, R2 = symbols('R1, R2')
b = Beam(4, E, I)
b.apply_load(R1, 0, -1)
b.apply_load(-1000, 0, 0)
b.apply_load(R2, 4, -1)
b.bc_deflection.append((0, 0))
b.bc_deflection.append((4, 0))
b.solve_for_reaction_loads(R1, R2)
Msg(b.reaction_loads)
b.plot_shear_force()
b.plot_bending_moment()
Code: Select all
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17477 (Git)
Build type: Release
Branch: master
Hash: 8806e4490606d7a1be52c831049b17d8c8d9c320
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Last edited by chakkree on Wed Jul 31, 2019 6:19 am, edited 2 times in total.
Re: Solving Beam Bending with SymPy
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Solving Beam Bending with SymPy
Test Continuous beam with 2 spans. Uniform load all 1000.
Source Code
Source Code
Code: Select all
from sympy.physics.continuum_mechanics.beam import Beam
from sympy import symbols
L1 = 4.0
L2 = 3.0
E, I = symbols('E, I')
R1, R2 , R3 = symbols('R1, R2, R3')
b = Beam(L1+L2, E, I)
b.apply_load(R1, 0, -1)
b.apply_load(R2, L1, -1)
b.apply_load(R3, L1+L2, -1)
b.apply_load(-1000, 0, 0)
b.bc_deflection.append((0, 0))
b.bc_deflection.append((L1, 0))
b.bc_deflection.append((L1+L2, 0))
b.solve_for_reaction_loads(R1, R2 , R3)
Msg(b.reaction_loads)
b.plot_shear_force()
b.plot_bending_moment()
Code: Select all
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17477 (Git)
Build type: Release
Branch: master
Hash: 8806e4490606d7a1be52c831049b17d8c8d9c320
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
- hardeeprai
- Posts: 177
- Joined: Sun May 23, 2010 2:41 pm
- Location: Ludhiana, Punjab, India
- Contact: