Have you ever asked yourself how structural software essentially works? Just keep reading, and you will find how we can use the SkyCiv platform and Python programming through an example developed in a classroom of Structural Analysis.

CHECK OUT THE python code

A quick review of structural analysis

We often use software available to solve a structural analysis, which results in forces, displacement, stresses, etc. In simple terms, the problem drops into the following form:F=Kd



  • F is the vector forces
  • K is the structure stiffness
  • d is the displacement field

The main goal is to convert a continuous structure into discrete “pieces” of an assembly and analyze it, obtaining forces and displacements. A general path has to be followed:

  • Preprocess: the first step in structural analysis, where we get the structure data, geometry, material properties, and loads and finalize when the global stiffness matrix is constructed.
  • Process: where we solve the previous expression, F=Kd F=K∙d. Some methods generally accepted to solve the linear equations system is Gauss-Jordan, Gaussian elimination, etc.
  • Postprocess: the final part to display the results in terms of forces and stress, if necessary.

Planar frame example

The case example consists of a regular planar frame (Figure 1).

SkyCiv and Python Programming - Structural Analysis

Figure 1. Structural 2D Frame Example

The element’s properties for columns, beams, and materials are:

Structural element Area, (mm^2) Inertia, (mm^4)
Columns 93,000 720,000,000
Girders 140,000 2,430,000,000

Concrete properties:

  • Material strength, fc=20MPa     f′c=20MPa
  • Young’s Modulus, E=17000MPa E=17000MPa

Python programming and SkyCiv Modelling

Now is the time to start working in parallel with modeling in Python and SkyCiv. Figure 2 shows the input data (nodes, elements, degrees of freedom, local axis orientation) for the code developed in Python. You can check the file yourself and run the example through this link.

SkyCiv and Python Programming - Local stiffness matrix functions

Figure 2. Local stiffness matrix function

The Python file uses a functional programming paradigm because it is easy to explain and develop in the classroom. This consists of dividing and conquering, modularizing the code construction and its methods.

CHECK OUT THE python code

When coding the method, the most important is to define the mathematical formulation to apply.  We will use the Euler Bernoulli Beam:

Copy to Clipboard
CHECK OUT THE python code

In summary, the steps required to run the analysis using Python programming are as follows (We reproduce some parts of the Python script):

  • Define nodes and their coordinates (xi, yi )
Copy to Clipboard
  • Determine the global stiffness matrix for each element (kg)
Copy to Clipboard
  • Assembly of the global structure stiffness matrix (Sg )
Copy to Clipboard
  • Determine the global load vector for each element and assembly it into the general structure load vector (P, Pf)
Copy to Clipboard
  • Solve the general equation for the field displacement ({P – P_f} = [S]{d})
Copy to Clipboard
  • Obtain the global and local forces for each element (Fi, Qi)
Copy to Clipboard
CHECK OUT THE python code

The SkyCiv model and loads applied are shown in figure 3. We only consider one load case, including gravitational and lateral forces applied to nodes.

SkyCiv and Python Programming - Load applied

Figure 3. Loads applied on the frame (Only one combination load case)

Results and comparison

After running the SkyCiv model and the python file, it is time to compare and analyze the results.

1. Field displacement

SkyCiv and Python Programming - Field displacement

Figure 4. Total Displacement in SkyCiv (millimeters)


d, mm, SkyCiv d, mm, Python Script (Delta )%
88.76 92.845 4.40
-0.414 -0.416 0.48
141.493 151.641 6.69
-0.652 -0.653 0.153
141.284 151.423 6.69
-0.987 -0.986 0.101
88.694 92.786 4.41
-0.679 -0.677 0.295

The differences in values (Python Script and SkyCiv S3D) are minor, with approximately 2.90% as the mean.

2. Axial forces

SkyCiv and Python Programming - Axial forces

Figure 5. Axial forces developed into the frame

Q, kN, SkyCiv Q, kN, Python Script (Delta )%
109.056 109.519 0.423
62.857 62.616 0.383
41.589 43.252 3.845
13.113 11.709 10.707
81.143 81.384 0.296
178.944 178.480 0.2593

The differences in values (Python Script and SkyCiv S3D) are minor, with approximately 2.65 % as the mean.

3. Shear forces

SkyCiv and Python Programming - Shear forces

Figure 6. Shear forces developed into the frame

Q, kN, SkyCiv Q, kN, Python Script (Delta )%
35.318 35.039 0.790
35.318 35.039 0.790
-11.569 13.252 12.700
-11.569 13.252 12.700
62.857 62.616 0.383
-81.143 -81.384 0.296
46.199 46.903 1.501
-97.801 -97.097 0.720
41.569 43.252 3.891
41.569 43.252 3.891
54.682 54.961 0.508
54.682 54.961 0.508

The differences in values (Python Script and SkyCiv S3D) are minor, with approximately 3.22% as the mean.

4. Bending moments

SkyCiv and Python Programming - Bending moment

Figure 7. Moments developed into the frame

Q, kN-m, SkyCiv Q, kN-m, Python Script (Delta )%
-130.993 -133.213 1.667
80.916 77.022 4.812
37.358 42.713 12.537
-32.057 -36.797 12.881
-32.057 -36.797 12.881
-141.776 -149.400 5.103
43.558 34.309 21.234
-266.054 -266.859 0.302
107.639 110.109 2.243
-141.776 -149.400 5.103
169.676 173.016 1.930
-158.415 -156.749 1.052

The differences in values (Python Script and SkyCiv S3D) are minor, with approximately 6.81% as the mean.

5. Conclusion

This post has served as a test that the SkyCiv platform is an excellent resource for educational purposes due to its powerful capacities in structural analysis. Using Python programming and comparing the results with accurate software as SkyCiv, is a must that every engineering course must include in its core content.