GSoC 2023 Application Abhinav Cillanki: Improving physics.continuum_mechanics subpackage - sympy/sympy GitHub Wiki

Improving physics.continuum_mechanics subpackage (sympy.physics.continuum_mechanics)

The physics.continuum_mechanics submodule (physics.continuum_mechanics) currently has the functions to find the shear force, bending moment and deflection in the beams using functions shear_force, bending_moment, deflection. However, there is no function present to find the deformation due to buckling in the beam. Hence, more work needs to be done to add this functionality. The loads that can currently be used are point load, moment, constant distributed load, upward ramp load and parabolic ramp load. There is a necessity for further generalisation of the functions so that more variety of problems can be solved.

Personal Background

Name: Abhinav Cillanki

University: Indian Institute of Technology Kharagpur

Short bio:

  • I am a sophomore studying Mechanical Engineering at Indian Institute of Technology, Kharagpur. I am proficient in python and have been programming since Eighth grade.
  • Pursuing my Bachelor's degree in mechanical engineering, I have studied about continuum_mechanics through the course Mechanics of solids (Course info).
  • I am extremely enthusiastic about robotics and have been using computer algebra in programming robots to play soccer and compete in various Robosoccer competitions.
  • I am also quite interested in optimizing algorithms and I have a zeal for Game Theoric algorithms. I am the Head Strategist at our college club for Game theory.
  • Being interested in Open Source, I am looking to find my first big Open Source project through GSOC-2023 and hoping to get guidance from the mentors to help me succeed.

Contact info:

Programming Background

Platform used: Linux (Ubuntu)

Editor: Visual Studio Code

Experience in coding:

  • Intermediate: Python, C++
  • Beginner: Java, Javascript, C

Experience with python:

  1. To solve mechanics problems: MechSolids
  2. In computer vision projects: CV-project
  3. To program robots: RoboSoccer
  4. Machine learning and Deep learning

Open Source projects

Views on python

  • I feel it is possible to create absolutely anything with python. Python has made programming simple to understand and implement. It was the first programming language I became familiar with. The extensive Standard Library is one of the most amazing features of Python and it has helped me see how I can create multipurpose projects.
  • I am familiar with Object Oriented Programming using python and have used it in the above mentioned projects. The syntax being quite similar to what is used in the Sympy codebase, I feel i can contribute better.

Familiarity with git

I am quite familiar with git and have been using it for a couple years now. However, I am new to the tests that are performed by Travis CI and will get familiar with it in the process of contributing.

Example of my favourite feature in Sympy

Q) There is a beam of length 30 meters. A moment of magnitude 120 Nm is applied in the clockwise direction at the end of the beam. A pointload of magnitude 8 N is applied from the top of the beam at the starting point. There are two simple supports below the beam. One at the end and another one at a distance of 10 meters from the start. The deflection is restricted at both the supports. Find the support reactions.

A.)
>>> from sympy.physics.continuum_mechanics.beam import Beam >>> from sympy import symbols >>> E, I = symbols('E, I') >>> R1, R2 = symbols('R1, R2') >>> b = Beam(30, E, I) >>> b.apply_load(-8, 0, -1) >>> b.apply_load(R1, 10, -1) # Reaction force at x = 10 >>> b.apply_load(R2, 30, -1) # Reaction force at x = 30 >>> b.apply_load(120, 30, -2) >>> b.bc_deflection = [(10, 0), (30, 0)] >>> b.load >>> b.solve_for_reaction_loads(R1, R2) {R1: 6, R2: 2}

Me and my project

1. Buckling

Currently, the beam.py program has functions that aid us in calculating the reactions to only transverse loads i.e. shear force, bending moment, deflection. I wish to add functions that will let us see the reactions to axial loads, like buckling of the beam. This would mean looking at the beam from all ends and finding out when the beam will fail.

Now, What is Buckling?

Buckling is the event where a beam spontaneously bends from straight to curved under a compressive load. It occurs when the axial compressive load exceeds the critical load. The critical buckling load is independent of the strength of the material. There will be decrease in length of the beam under the compressive load until a certain critical value of the load. After that, the beam deforms and the decrease in length will not be valid any further. So, we will have to add cases where the beam will fail to bear the load.

Implementing buckling in the code

In the 2D beam or simply, the class Beam in the beam.py file, we will check for buckling using the formula:

image

  • Pcr is the maximum (critical) load that the beam will be able to bear before buckling
  • E is the modulus of elasticity for the material
  • I is the moment of inertia for the column’s cross-sectional area
  • L is the Effective length of the beam
  • This formula can be derived from a fourth order differential equation which is mentioned in Task 3.

The value of Pcr will be calculated using the above formula and the value of L will be calculated using the following convention:

image

  • L is the length of the beam in the figure

  • the effective length for the beam in various cases are:

    • L if both ends of the beam are pinned
    • 0.5L if both ends of the beam are fixed
    • 2L if one end of the beam is fixed and the other end is free
    • 0.7L if one end of the beam is fixed and the other end is pinned
  • For the case of a 3D beam, we will check for the column of the beam that will have the least critical load and will use that value to check for buckling. Note: Columns are long slender members that are subjected to axial compressive loads

Examples of problems we will be able to solve by achieveing this:

Q1. An A-36 steel column has a length of 15 ft and is pinned at both ends. If the cross-sectional area has the dimensions shown, determine the critical load.

image

Steps to solve such questions:

a) First we will calculate the moment of inertia for the cross-sectional area of the column. For this, we will have to create a function that will calculate the moment of inertia for certain shapes such as a rectangle and a circle. The moment of inertia for various shapes is given by:

image

We sum up the moment of inertia for the four rectangles in this problem and get the moment of inertia for the cross-sectional area of the column.

b) Now we will calculate the critical load for the column using the formula given above. We will use the value of the moment of inertia calculated in the previous step. The value of the modulus of elasticity for A-36 steel is 29000 ksi. Since this is a pinned-pinned column, the effective length of the column is 15 ft (Leff = L).

2. Generalize the beam functions

The aim is to generalize the usage of the beams by creating functions that will help in solving any arbitrary equation of loading on the beam. Currently the only type of loads that can be applied on the beam using the library are point loads, Moments, constant distributed loads, ramp loads and Parabolic ramp loads. However, the loads may not be limited to these simple cases and might follow more complex variations.

The ramp load is varying from left to right in an increasing fashion. There is no functionality that allows us to create a decreasing ramp load or a negative sloped ramp load. Creating a more general method to declare the beams is necessary to make this happen.

Examples of problems we will be able to solve by achieveing this:

Q1. Construct the shear and moment diagrams for the loaded beam shown. Determine the maximum bending moment and its location.

image

Steps to solve such questions

a.) Since this load is quadratic in nature, we can split the distributed load into three loads:

  • The parabolic ramp load : x^2
  • The ramp load: x
  • The constant distributed load: constant

b.) We solve for these individually using the existing functions and get the expression of loads in terms of singularity functions.

c.) The other approach would be to solve using calculus. We integrate the load function to obtain shear force. We further integrate shear force to get bemding moment, Differentiate the load function to obtain the deflection. We use the boundary conditions to find the integration constants.

3. Use of fourth order differential equation for deflection and buckling

Currently, beam deformation problems are being solved by integrating the second order differential equation. We could also solve this using the fourth order differential equation which would require us to specify the boundary conditions using which we will compute all reactions of the beam i.e shear force, bending moment, deflection.

image

  • v is the deflection
  • w is the distributed load function
  • V is the shear force
  • M is the bending moment

Motivation:

Being a student who is studying Mechanical engineering, I encounter problems relating to beams on a regular basis. Having a passion for coding, I enjoy trying to automate the solutions to these problems while also getting a better grasp on the subject. The physics.continuum_mechanics subpackage and other physics.mechanics subpackages are relavant to what I will be studying in college. I have found an interest in solving beam problems using the Object-Oriented approach and can truly appretiate the beauty of object oriented programming.

Qualifications:

The courses I have studied in my college that are directly helping me to implement my idea are:

  1. Mechanics of solids <Mechanics of Solids IITKgp>
  2. Basic Engineering Mechanics <Mechanics IITKgp>
  3. Partial Differential Equations <PDE IITKgp>
  4. Advanced Calculus <Advanced Calculus IITKgp>
  5. Transform Calculus <Transform Calculus IITKgp>
  6. Fluid Mechanics <Fluid Mechanics IITKgp>

Prior implementations:

To my best knowledge, buckling has not been implemented before using code. It has not been published anywhere if it has been implemented. There is a lot of content available on buckling in various textbooks and I will be referring them to complete this project. The textbooks are mentioned in the reference section.

Summer logistics:

I will be having my semester examinations till 28th of April. I will be able to work for 10 hours per week before that. After April 28th, I would be having a semester break after the end of my fourth semester. During this time, I will have minimal to mediocre commitments to other research activities and I can dedicate around 28 hours a week during Phase 1 and around 21 hours a week during Phase 2. This reduction in working hours will be mainly due to my involvement in academics and a few robotics competitions I will be participating in.

Tentative Timeline

1. Pre-GSoC Period: till May 4

  • Wrap up any remaining work from the previous PRs.
  • Get familiar with using all library functions that are used in the file beam.py
  • Get involved in active contribution to the continuum_mechanics section
  • Learn what more I can contribute from my mentors
  • Also start creating a basic structure for various parts of the project to maintain a synchronized and uniform progress in this direction.

Community bonding period: May 4 - 28

  • I will introduce myself formally to Sympy community, discuss the proposal with Mentors.
  • This period will also involve me getting familiar with the particular coding style preferred by the organization
  • Will try to create basic functions that will be required for completing the project.

Coding period (Phase 1): May 29 - July 10

  • Complete generalising the beam functions as they will be useful for buckling problems as well. This will involve:

    • Creating a function to accept the equation of distributed load and solve for the load at individual points.
    • Finding out necessary changes in the current functions to use the equation to find all other values i.e shear force, bending moment.
    • (Pull Request 1 - phase 1)
  • Start working with the proposed plan in Buckling of beams:

    • Calculating the second moment of area for shapes. (Pull Request 2 - phase 1)
    • Breaking the cross section into parts of shapes based on the description of the cross sectional area.
    • Develop a function to sum up the individual moment of inertia.
  • Start creating PRs and pushing the commits for the upcoming mid-evaluations. (Any other pull requests before mid evaluations)

Mid-Evaluations: July 10 - July 14

Coding period (Phase 2 begins): July 14 - August 21

  • Solve the deflection of beams using fourth order differential equation. (Task3 would be completed here) [Pull request 1 - phase 2]

  • Generalise the deflection of beams along with previously completed shear force and bending moment. (Task 2 would be completed here) [Pull request 2 - phase 2]

  • Buckling of beams:

    • Calculate the critical load for the column using the previously calculated moment of inertia.
    • Apply the buckling for Beam3D by checking all columns of the beam for the minimum critical load. [Pull request 3 - phase 2]
    • Create necessary functions for calculating the axial deformation before before buckling of the beam. (Task 1 will be complete here) [Any remaining pull requests]
  • If I am ahead of my schedule,

    • I will work on the pre-existing function that joins two beams and will tailor it to work for the above generalised cases.
  • Complete any necessary point-outs by the mentor and the community

Final Evaluations: August 28 - September 4

Post GSoC and Future work:

  • I would like to continue contributing to the Sympy community and keep pushing improvements to physics.continuum_mechanics submodule.
  • I would also start contributing to other mechanics modules of Sympy as the theory will be taught in our college in the upcoming semesters.

Contributions to Sympy:

Pull request 1 -- Correcting the grammar in the Doctest: Merged

Pull request 2 -- Pull request on fixing the ramp load: Open

Pull request 3 -- Computed max positive and negative values of shear force and bending moment: Open

Pull request 4 -- Reduced code repetition in plot.py: Closed

Issue 1 -- Issue raised on the ramp load being wrong

Issue 2 -- Issue raised on improving the quality of plots

References:

Problems on beams

Theory of Elastic Stability by Timoshenko and Gere (for problems on buckling)

R. C. Hibbeler(for buckling and fourth order differential equation representation)

Beer & Johnston(for problems on beam deflection)

My professor's repository(for basic understanding)

Image source 1(effective length of a beam)

Image source 2(Moment of inertia of shapes)

Image source 3: R.C. Hibbeler