GSoC’19: Week 3 – Wrapping up Stage-I

This week started with working on PR #17001. The algorithm was extended to handle concave polygons as well. I came up with a new method which I have explained in the wiki page that I have created. It has to be tested against some symbolic coordinates to make it a complete method.

The API of the CrossSection class has been changed as discussed in the last week. The documentation of the class has been completed.

There were some discussions being done on the necessity and the importance of the CrossSection class. Despite the CrossSection class providing some very useful functionalities of calculating the section modulus, the first moment of area and polar modulus, is there really a need for such a class? After getting some pros and cons listed out we got to a conclusion, that it would probably be better to add these functionalities directly to the geometry module.

But the question of complex geometries like T-shape and I-shape still remains. The alternative to this that we came up with in the discussion was Boolean operations on simple polygons. There are some clipping algorithms like Vatti algorithm and Greiner Hormann algorithm which might be helpful in implementing these.

In short, this is what is left to be done:

  • Transferring the cross-sectional properties defined in the CrossSection class to the geometry module
  • Making the beam class to accept any geometry instead of the second moment that is currently accepted from the user.

In later stages, I might try to work on the Boolean operations as currently there is a limitation of time and the implementation of the stage -II awaits.

After this, the stage-I would end and I will have to start with the next implementation i.e. the column buckling calculations

Next Week:

  • Completing leftovers of the previous week
  • Starting off with stage-II

The work and the progress during the stage-I were full of ups and downs. Will try to make it smoother this time. Will try to discuss the implementations with the mentors and the members in even more detail. Hope to have a good coding week.

Will keep you updated!



GSoC’19: Week 2 – Working on CrossSection class

The second week has ended and here I am to give you a brief about the week’s work!

The week started with the opening of a PR #16964 which intended to define a class CrossSection as planned. Discussions have been done in this PR regarding its API and its need. All these discussions lead to a conclusion of making a slight change in the API to make it accept any arbitrary cross-section which the user can define using the geometry module. So now the CrossSection class will take the input of a pre-defined object of the geometry module and calculate its corresponding properties. This will make the CrossSection class much simpler and generalized. I will be updating the same in the PR soon.

I had also researched some of the previous works done in this area. PR #14434, which intends to implement a shape class, giving functionality to cut an ellipse or a parabola via a line and determine the properties of the newly formed segment. I have tried to implement a similar concept to the Polygon class via a method cut_section() in PR #17001.

Also since one of the major issues also was to determine the first moment of area, this PR would further help in the calculation of the first moment of area. It intends to give the Polygon class functionality to return a new Polygon segment formed when a given line intersects the Polygon. Although, an alternative method of Polygon triangulation also has been discussed in this PR, to determine the first moment. I will have to do a bit of research for this to get this implemented.

Next Week:

  • Implementing a method to determine the first moment of area
  • Completing the CrossSection class along with its documentation and testing
  • Linking it with the beam module
  • Working over the implementation of Stage-II

I will try to make the CrossSection class fully functional, by the end of the coming week.

Will keep you updated!


GSoC’19: Week 1 – Starting with the CrossSection class

The GSoC timeline started as soon as the projects were announced and so did the work on projects.

The Community bonding period ended last week. There wasn’t much work in the community bonding period. All I had to do was to extend my knowledge base related to the project and to familiarize with the development flow.

I started with going through the geometry module, which has a major role to play in the implementation of the Stage-I i.e. the implementation of CrossSection module. Also, I studied about the different properties of cross-sections, like, the first moment of area, polar modulus, section modulus, etc.

So the coding period started on 27th May and now the first week is completed. My task in the first week was to start the implementation of the CrossSection module. It majorly comprised of defining a new class CrossSection.

Major tasks inside the CrossSection class were:

  • Defining the different geometries using the geometry module:
    • Circle: A circular cross-section was easily defined by using class sympy.geometry.ellipses.Circle
    • Rectangle, I-section, T-section, triangle: These four shapes were defined using class sympy.geometry.polygons.Polygon. These geometries were defined using point to point mapping in the counter-clockwise direction in such a way that it starts at the origin and joins all the given points or vertices of the polygon in the given sequence.
    • All these geometries were defined in a way that they lie in the first quadrant, in order to get correct values of the centroid.
  • Defining different properties of the above cross-sections:
    • Area
    • Centroid
    • Second moment
    • Polar modulus
    • Section Modulus
    • First moment

Implementing these was not that difficult as area, centroid, the second moment are already implemented in the geometry module. On the other hand, polar modulus and section modulus were specifically defined in the CrossSection module separately for each geometry.

The problem of defining the first moment of area:

The way the first moment of area is calculated can be seen from here. And since the first moment of area is required majorly to calculate the Transverse shear stress on a beam, we are interested only in the first moment along the x-axis (or the horizontal axis).

But just a day pondering over it I realized that the first moment calculated as above calculates it for the extreme layer of the beam. Probably, we will have to return it in terms of y, so that the shear stress at any layer could be calculated.

where “y” is the distance of the layer of the beam from the neutral axis

So, I will be opening an issue-cum-discussion regarding the above problem to discuss it with the mentors. Also, I will soon be opening a work-in-progress PR regarding what has been implemented.

Next Week:

  • Completing the CrossSection class and linking it with the beam module via an add_cross_section() function.
  • Adding tests to the CrossSection module and in the Beam module
  • Completing documentation of the CrossSection module.

Since I had to travel this weekend there was a bit of delay in the progress. But I am positive that I will be able to compensate for it in the next week. Also, I will try to keep the work a bit in advance.

Will keep you updated!


Blog at

Up ↑