integrate with python
Minimum version: v2.5
In this example, we demonstrate how to use python to preprocess data by creating a frame structure. This example requires some Python familiarity. However, as we are developing a frame structure which contains mainly frame elements, the procedure is relatively straightforward.
Objective
We are going to create a three--storey frame as shown below.
Prerequisites
We are going to find section properties from AISC table, which is available online.
Section properties such as area and moment of inertia can be extracted from this table using section designations. It is possible to define such a function now.
Then we can use this function to extract section properties from the table. For example,
Geometry of the Frame Structure
For simplicity, we assume the frame structure has the same column/beam section for all the columns/beams on the same floor. Under such a condition, two lists of section designations can be provided so that elements can be created. Similarly, geometry information such as floor height, bay span, as well as floor mass, can be provided in the same way.
For example, we can define several lists as follows.
Generate Node Grid
Given that span and height are given, it is possible to calculate the absolute position of the nodes.
By using the above coordinates, we can create a grid of nodes. A simple Node class is defined to represent nodes.
The node_grid can be used to generate elements.
Generate Beam Elements
Starting with the second row, beam elements can be generated by looping over each row.
Generate Column Elements
Similarly, column elements can be generated by looping over each column.
Fibre Based Elements
The similar procedure can be used to generate fibre based elements with slight modifications. Here we use F21 element. It relies on sections, and designations can be directly used to create sections. In this example, we use US2D category.
Generate Mass
For simplicity, we only apply horizontal mass to each node, the procedure is similar to that of frame elements.
To keep code modular, we define a mass grid to store mass at each node.
Now we assign mass to each node.
Analysis Settings
The basic geometry of the model is defined in node.sp, beam.sp, column.sp and mass.sp. We import those files in the main script.
The boundary conditions can be assigned by simply fixing all bottom nodes.
The ground motion shall be applied. The ELNS file contains one of the accelerograms of the 1940 El Centro Earthquake. It is normalised so that the maximum amplitude is unity, we assign a PGA of .
For results, we can, for example, record the nodal displacement history.
For illustration, we can also record element yield flag at both ends so that the corresponding plastic hinge distribution can be generated. The yield flag is not generally available in other elements.
We keep writing dynamic analysis step and the corresponding settings into the file.
Do not forget to close the main file.
Finally, let's pack everything into an archive so that it can be downloaded.
Run Analysis
The analysis can be run by calling the executable.
The online documentation is not calling the executable, but it is possible to run the analysis locally with the application available.
Roof Displacement History
The result file will be generated and stored in .h5 file. We can read the file and plot the results.

Clean up the files to end this example.
Let's create some TikZ commands to be used to plot plastic hinge distribution.
Last updated