An interactive Jupyter notebook that applies the Portal Method to approximate the shear forces and bending moments in the beams and columns of a multi-storey, multi-bay rectangular frame subjected to lateral loads (wind / seismic).
The Portal Method is a hand-calculation approximation technique used in structural engineering for the preliminary analysis of building frames under lateral (horizontal) loads. It assumes:
- A point of contra-flexure (zero bending moment) at mid-height of every column.
- A point of contra-flexure at mid-span of every beam.
- Interior columns carry twice the shear of exterior columns in the same storey.
These assumptions reduce the frame to a set of simple portals that can be solved using statics alone, making it very fast compared to the cantilever method or a full finite-element analysis.
portal-method/
│
├── data/
│ └── portal.xlsx ← Input file (edit this with your frame data)
│
├── portal_method.ipynb ← Main notebook (run this)
│
├── requirements.txt ← Python dependencies
├── .gitignore ← Files Git should ignore
└── README.md ← You are here
Open data/portal.xlsx and fill in one row per storey, from top to bottom:
| Column name | Unit | Description |
|---|---|---|
beams |
— | Storey number (1 = top storey) |
force |
kN | Lateral force applied at this storey level |
distance between beams from top |
m | Storey height (floor-to-floor) |
distance between columns |
m | Bay width (column-to-column) |
Example (3-storey, 4-column frame):
| beams | force | distance between beams from top | distance between columns |
|---|---|---|---|
| 1 | 15 | 3.5 | 5 |
| 2 | 30 | 3.5 | 7 |
| 3 | 30 | 4.0 | 5 |
The number of bays is inferred from the number of non-empty rows in the
distance between columnscolumn (bays = rows with a value, columns = bays + 1).
- Go to colab.research.google.com.
- Click File → Upload notebook and upload
portal_method.ipynb. - Upload
portal.xlsxto the Colab file panel (click the folder icon on the left sidebar → upload). - In the notebook, update
EXCEL_PATHto match where you uploaded the file, e.g."/content/portal.xlsx". - Click Runtime → Run all.
Prerequisites: Python 3.8 or newer.
# 1. Clone the repository
git clone https://github.com/<your-username>/portal-method.git
cd portal-method
# 2. (Recommended) Create a virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Launch Jupyter
jupyter notebook portal_method.ipynbThen run all cells (Kernel → Restart & Run All).
The notebook produces:
- Printed tables – column shear, column moment, beam shear, beam moment for every storey and bay.
- Shear Force Diagram – plotted on the frame outline and saved as
shear_force_diagram.png. - Bending Moment Diagram – plotted on the frame outline and saved as
bending_moment_diagram.png. - Summary DataFrames – final results in a clean tabular format.
See requirements.txt. The core dependencies are:
| Package | Purpose |
|---|---|
pandas |
Reading the Excel input and building result tables |
openpyxl |
Excel (.xlsx) engine for pandas |
numpy |
Numerical helpers |
matplotlib |
Plotting the SFD and BMD |
- The Portal Method is an approximate method. Results may differ from those of an exact analysis (e.g. stiffness-matrix / FEM) by 10–30 % depending on the frame geometry.
- It is best suited for regular, rectangular frames with roughly equal bay widths and storey heights.
- The method does not account for axial deformations, shear deformations, or geometric nonlinearity.
MIT License – see MIT license
Uddipta Bhaskar Sarma (uddiptasarma361@gmail.com) – feel free to open an issue or pull request if you find a bug or want to suggest an improvement.