Skip to content

High-performance, educational C++ project with modular and extensible architecture for solving physics problems using state-of-the-art numerical methods

License

Notifications You must be signed in to change notification settings

Krasnovvvvv/numerical-methods-in-physics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

449 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Numerical Methods in Physics

GitHub last commit MIT License Issues Stars

Ubuntu Windows macOS

CI Ubuntu CI Windows CI macOS

This project contains C++ implementations of a variety of classic and modern numerical techniques, applied to physical problems encountered in laboratory courses and practical assignments. The codebase is designed with clarity, scalability, and reproducibility in mind


ℹ️ About

These laboratory works showcase algorithms for solving core computational physics problems. The implementations are modular and leverage clean C++ patterns to facilitate study, reuse, and extension for new problems


📁 Project Structure

numerical-methods-in-physics/
├── images/               # Necessary graphs
├── include/              # Public headers for numerical modules and solvers
├── reports/              # Markdown lab reports and practical results
├── src/Labs              # Source files (lab tasks implementations)
├── CMakeLists.txt        # Build configuration (CMake)
├── vcpkg.json            # Dependency manifest
├── README.md             # Project overview and instructions
├── LICENSE               # MIT License
├── .gitignore            # Git ignore rules

🔬 Laboratory Topics

🧮 Systems of Linear Algebraic Equations (SLAE)

Demonstrates solving tridiagonal and arbitrary systems using direct and iterative methods (e.g., Thomas algorithm, Jacobi, Gauss-Seidel), with application to real modeling tasks

🌱 Root Finding Algorithms

Contains implementations of the bisection (dichotomy), Newton, and simple iteration methods for solving non-linear equations. Demonstrates convergence efficiency and robustness on real physical functions

📐 Numerical Integration

Features various quadrature methods (rectangular, trapezoidal, Simpson's), with error analysis and comparisons on benchmark test cases

📊 Ordinary Differential Equations (ODEs)

Includes explicit and implicit schemes for ODEs, such as Euler, improved Euler and Runge-Kutta methods, tested on classical physical systems (oscillator, decay, etc.)

🏁 Boundary Value Problems for ODEs

Presents approaches for numerically solving ordinary differential equations with boundary conditions, including finite difference schemes, shooting methods, and matrix formulations. Analysis includes stability, convergence on heat conduction and physical diffusion models

∫📈 Fredholm and Volterra Integral Equations

Demonstrates numerical solution of linear Fredholm and Volterra integral equations of the second kind using quadrature-based methods (trapezoidal rule, Simpson’s rule, Gauss–Christoffel formulas) and piecewise-linear approximation of the unknown function on a grid, with analysis of how the choice of quadrature and mesh size affects accuracy, stability, and error propagation in test problems

🔥 Parabolic PDEs: Heat Equation and Difference Schemes

Studies numerical solution of 1D heat‑conduction boundary‑value problems using finite‑difference schemes on uniform space–time grids. Implements explicit, implicit, and weighted (θ‑method) schemes for the heat equation with various boundary conditions, and compares temperature profiles and error behaviour for different time and space steps to analyse stability limits, numerical diffusion, and the influence of the weighting parameter on accuracy

🌊 Convection Equations: Explicit and Implicit Schemes

Demonstrates numerical solution of the 1D linear convection equation with prescribed and periodic boundary conditions using explicit and implicit finite‑difference schemes of first and second order (FTCS, first‑ and second‑order upwind, Lax–Wendroff, MacCormack, Richtmyer, BTCS). Compares numerical and exact solutions and visualizes the maximum error in time to study how the Courant number, stencil choice, and approximation order affect stability, numerical diffusion, dispersion, and long‑time error growth

📡 Hyperbolic PDEs: Wave Equation and Weighted Schemes

Demonstrates numerical solution of the 1D wave equation with source term and given initial and boundary conditions using finite‑difference methods on uniform space–time grids. Implements the explicit second‑order “cross” scheme and a weighted scheme, and compares their stability and accuracy by varying time and space steps, visualizing wave propagation, reflection from boundaries, and analysing how the choice of weights affects numerical dispersion and error growth


🚀 Getting Started

🛠️ Prerequisites

  • C++17 compatible compiler (GCC, Clang, MSVC)
  • CMake 3.14 or newer
  • matplot++ development files
  • Eigen library (header-only, managed via CMake or package manager)

⚡ Build

To build the code, standard CMake workflows are recommended:

git clone https://github.com/Krasnovvvvv/numerical-methods-in-physics.git
cd numerical-methods-in-physics
mkdir build && cd build
cmake ..
make
./lab_executable

📄 Reports

All completed laboratory reports (including results, and code descriptions) can be found here:

📝 Report Link
Systems of Linear Algebraic Equations 📄 Read
Root Finding Algorithms 📄 Read
Integrating Algorithms 📄 Read
Solving ODEs Algorithms 📄 Read
Solving Rigid ODEs Algorithms 📄 Read
Boundary Value Problems for ODEs 📄 Read
Solving Integral Equations 📄 Read
Solving 1D Heat Equation 📄 Read
Solving Convection Equations 📄 Read
Solving 1D Wave Equation 📄 Read

📦 Dependencies

  • matplot++ — a high-quality C++ plotting library for scientific visualization
  • Eigen — a fast, versatile C++ library for linear algebra and matrix operations

These dependencies are automatically handled via CMake (assuming installed on your system or via package managers like vcpkg)


🤝 Contribution

Contributions, bug reports, and feature requests are welcome!
Please open issues or pull requests on the GitHub repository


📝 License

This project is licensed under the MIT License — see License

Languages