Section Properties with MeshPY, including torsion and warping

I recently discovered robbie van leeuwen’s structural engineering blog, which has an open-source set of Python routines for calculation of section properties, including torsion and warping constants.  The program uses the MeshPY Library for generating the finite element meshes required for the torsion and warping calculations.   The Python code for generation of the input to MeshPY, and for carrying out the finite element analyses, is all by Robbie van Leeuwen.

I have written an Excel front-end for these routines, allowing most of the functionality to be accessed quickly and easily, with no programming required.  The spreadsheet, including full open source code, can be downloaded from:

The spreadsheet requires the following software to be installed:

  • Windows version of Excel
  • Python version 2.7 or later (not checked with version 3)
  • xlwings version 0.11.4 or later
  • Matplotlib, Numpy and Scipy
  • The required MeshPY and other Python files are included with the download

The spreadsheet includes two calculation sheets:

  • Twelve defined shapes
  • Any shape defined by a series of coordinates

The screenshots below show the list of defined shapes and input and output for a rectangular hollow section:

Input cells are shaded blue.  Select a section type by number (1-12) and the required dimensions will update.  The optional input, Nu (Poisson’s Ratio) and mesh size (maximum area of each generated mesh element), is only required for the warping results.  The applied actions are only required for display of stress results.

The section properties output is shown in the two screen-shots below.  More detailed descriptions can be found at the on-line documentation.

For graphic display of the generated cross-section, element meshes, and stress plots under the input actions, click the “Display Stress Results” button:

17 images are shown in sequence in an external window.  Close each image to move on to the next.  There is currently no way to automatically save the images to the spreadsheet, but any image may be manually saved to disk as a png file.  At present each image must be viewed in sequence before control is returned to the spreadsheet.

The image window may be dragged to any required size (or made full-screen):

Stress distributions are generated for each of applied actions, and combined stresses:

The image window has tools to zoom and pan, and edit output format:

Sections defined by co-ordinates may be analysed on the second sheet.  The Python code has provision for analysis of sections with holes, but this is not yet implemented in the spreadsheet version:

The numerical results are as for the defined shapes:

The download file contains output for an asymmetrical I section, compared with the same section analysed in Strand7.  The geometric results are in exact agreement, to machine accuracy, except for the plastic modulus results, which have larger, but still very small differences.  The shear area, and torsion and warping constants have larger differences, due to different implementations of the finite element analysis, but are generally within 1%.

The output torsion and shear stress results from the spreadsheet are compared below with the equivalent results from Strand7:


This entry was posted in Beam Bending, Concrete, Excel, Finite Element Analysis, Frame Analysis, Link to Python, Maths, Newton, Numerical integration, NumPy and SciPy, Strand7, UDFs, VBA, xlwings and tagged , , , , , , , , . Bookmark the permalink.

4 Responses to Section Properties with MeshPY, including torsion and warping

  1. metroxx says:

    Looks amazing. Could be great if somedays there will possibility to use generated results (pictures) directly in Excel

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s