Skip to content

Praveenjhas/hpsc_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallel FEM Solver for 2D Beam/Frame Structures

This HPSC course project implements, verifies, profiles, and parallelises a finite element solver for static and free-vibration analysis of 2D beam/frame structures using OpenMP.

The main report PDF is:

report/white_paper.pdf

GitHub repository:

https://github.com/Praveenjhas/hpsc_project

Project Highlights

  • 2D Euler-Bernoulli frame element with 3 DOF per node: u, v, and theta
  • Static structural solve using K u = F
  • Free-vibration solve using K phi = omega^2 M phi
  • First natural frequency computed by inverse iteration
  • Sparse global stiffness matrix stored in CSR format
  • Lumped diagonal mass matrix
  • Jacobi-preconditioned Conjugate Gradient solver
  • OpenMP parallelisation for element stiffness, assembly paths, mass assembly, sparse matrix-vector multiplication, vector updates, and dot-product reductions
  • Cantilever validation against analytical beam formulas
  • Portal-frame structural demonstration
  • Stage-wise profiling, strong scaling, and weak scaling
  • Publication-style white paper with figures, result tables, limitations, and reproducibility details

Key Results

The generated run reported:

Metric Result
200-element cantilever tip-deflection error 1.41913e-05%
200-element cantilever first-frequency error 0.00733476%
Dominant profiled stage vibration_inverse_iteration
Dominant-stage runtime share 81.5273%
Best OpenMP strong-scaling speedup 5.7283x on 8 threads
Best strong-scaling efficiency 0.7160
Weak-scaling efficiency at 8 threads 0.5650

Demonstration Cases

Case Inputs Purpose
Cantilever beam L = 10 m, E = 200 GPa, A = 0.003 m^2, I = 8.0e-6 m^4, rho = 7850 kg/m^3, end load -1000 N Verify static deflection and first natural frequency against beam theory
Portal frame Width 8 m, height 5 m, E = 200 GPa, A = 0.004 m^2, I = 1.2e-5 m^4, rho = 7850 kg/m^3, top load (Fx, Fy) = (3000, -12000) N Demonstrate frame behaviour for vertical columns and a horizontal beam

Solver Settings

Solver Limit Stopping criterion
Static CG 5000 iterations Relative residual <= 1e-10
Inner CG inside inverse iteration 5000 iterations Relative residual <= 1e-10
Cantilever inverse iteration 100 iterations Relative eigenvalue change < 1e-9
Portal-frame inverse iteration 100 iterations Relative eigenvalue change < 1e-8

Build

Using Make:

make

On Windows, the direct compiler command is:

g++ -O3 -std=c++17 -Wall -Wextra -Iinclude -fopenmp src/main.cpp src/fem.cpp src/sparse_matrix.cpp src/solver.cpp src/benchmark.cpp -o fem_solver.exe

Using CMake:

cmake -S . -B build
cmake --build build --config Release

Run

Cantilever demo:

.\fem_solver.exe demo 100 4

Validation sweep:

.\fem_solver.exe validation

Portal-frame demo:

.\fem_solver.exe portal 4

Stage-wise profiling:

.\fem_solver.exe profiling

Strong-scaling benchmark:

.\fem_solver.exe benchmark

Weak-scaling benchmark:

.\fem_solver.exe weak-scaling

Larger benchmark for stronger machines:

.\fem_solver.exe benchmark-large

Generate figures:

python scripts\plot_results.py

One-command Windows Workflow

For a clean full rerun:

powershell -ExecutionPolicy Bypass -File .\run_all.ps1 -Clean

This builds the C++ solver, runs validation and demos, profiles the solver, runs strong/weak scaling, generates plots, and builds report outputs.

Report and PDF Workflow

Main report files:

report/white_paper.tex
report/white_paper.pdf
report/PROJECT_REPORT.md
report/PROJECT_REPORT.pdf
report/PRESENTATION_OUTLINE.md

The final white paper PDF can also be regenerated through the browser-print workflow used on this machine:

powershell -ExecutionPolicy Bypass -File .\scripts\fix_runtime_share_figure.ps1
powershell -ExecutionPolicy Bypass -File .\scripts\whitepaper_to_html.ps1
& 'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe' --headless --disable-gpu --no-pdf-header-footer --print-to-pdf='C:\Users\HI\OneDrive\Desktop\assignment\hpsc_project\report\white_paper.pdf' 'file:///C:/Users/HI/OneDrive/Desktop/assignment/hpsc_project/report/white_paper.html'

Outputs

Generated data:

results/validation.csv
results/benchmark.csv
results/profiling.csv
results/weak_scaling.csv
results/displacement.csv
results/mode_shape.csv
results/portal_displacement.csv
results/portal_mode_shape.csv

Generated figures:

report/figures/cantilever_validation_errors.png
report/figures/cantilever_tip_displacement_convergence.png
report/figures/cantilever_frequency_convergence.png
report/figures/cantilever_deflection.png
report/figures/cantilever_first_mode_shape.png
report/figures/portal_frame_deflection.png
report/figures/portal_frame_first_mode_shape.png
report/figures/stage_runtime_profile.png
report/figures/stage_runtime_share.png
report/figures/openmp_speedup.png
report/figures/openmp_efficiency.png
report/figures/element_kernel_runtime.png
report/figures/weak_scaling_runtime.png
report/figures/weak_scaling_efficiency.png

Repository Layout

include/                 C++ headers
src/                     FEM solver, sparse matrix, solvers, and benchmarks
scripts/                 Plotting and report-generation helpers
results/                 Generated CSV outputs
report/                  White paper, final PDF, report figures, and outline
run_all.ps1              One-command Windows workflow
Makefile                 Make build entry point
CMakeLists.txt           CMake build entry point

Notes

The numerical model is a 2D linear Euler-Bernoulli beam/frame formulation. It uses a lumped diagonal mass matrix and computes the first natural frequency rather than a full modal spectrum. These assumptions are documented in the final white paper under the limitations and future-work section.

About

Parallel finite element solver for 2D beam and frame structures supporting static analysis and vibration (modal) analysis. Implements sparse matrix FEM, Conjugate Gradient solver, inverse iteration, and OpenMP parallelization with strong and weak scaling studies.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors