Features โข Installation โข Documentation โข Contributing โข Roadmap
Nuclear Physics Library is a comprehensive Fortran toolkit providing utilities, numerical solvers, and physics models to support the development of reactor simulations and multiphysics studies. Built for performance and accuracy, it offers a complete suite of mathematical kernels and physics models.
๐ง Core Utilities
| Component | Description |
|---|---|
| Precision Control | Standardised kind parameters (single, double, quad precision) |
| Physical Constants | Mathematical and physical constants with high accuracy |
| Random Number Generation | Deterministic RNG with multiple distributions |
| Numerical Utilities | Array operations, interpolation, integration, and safety functions |
๐งฎ Mathematical Kernels
- โ Dense matrix operations using BLAS/LAPACK
- โ Eigenvalue solvers (symmetric, general, generalised)
- โ Linear system solvers (LU, Cholesky, iterative methods)
- โ Sparse matrix operations (CSR format)
- โ SVD, QR, and Schur decompositions
| Method | Type | Use Case |
|---|---|---|
| RK4 | Explicit | Classic fourth-order Runge-Kutta |
| DOPRI5 | Adaptive | Dormand-Prince with adaptive step-size |
| Backward Euler | Implicit | Stiff equations |
- Gradient Methods: Gradient descent (with momentum, Adam)
- Conjugate Gradient: Fletcher-Reeves, Polak-Ribiรจre
- Quasi-Newton: BFGS, L-BFGS
- Constrained: Projected gradient, penalty methods
- Finite Difference: Various accuracy orders and boundary conditions
- Finite Volume: Conservation law solvers with multiple flux schemes
- Spectral Methods: FFT-based derivatives and Poisson solvers
โก Physics Models
| Model | Capabilities |
|---|---|
| Fluid Dynamics | Incompressible Navier-Stokes, projection method, natural convection, multi-region support |
| Heat Transfer | Diffusion-convection with sources, multi-material regions, coupled flow |
| Nuclear Fission | Point kinetics, multi-group diffusion, decay heat (ANS-5.1), 6-group precursors |
| Pressure Dynamics | Multiple EOS, acoustic waves, phase transitions, compressibility |
Important
Ensure you have the following installed:
- Fortran Compiler: gfortran 9.0+ or Intel Fortran
- CMake: Version 3.20 or higher
- BLAS/LAPACK: For linear algebra operations
- MSYS2: Required for Windows compilation
# Clone the repository
git clone https://github.com/PolskaKrowa/nuclear-physics-library.git
cd nuclear-physics-library/
# Create and enter build directory
mkdir build && cd build
# Configure with CMake
cmake ..
# Build the library (using all available cores)
make -j$(nproc)
# Install to system (requires sudo)
sudo make installcmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
make -j$(nproc)
make install| Configuration | Command | Use Case |
|---|---|---|
| Release | cmake -DCMAKE_BUILD_TYPE=Release .. |
Production with optimisations |
| Debug | cmake -DCMAKE_BUILD_TYPE=Debug .. |
Development with symbols |
| Intel Compiler | cmake -DCMAKE_Fortran_COMPILER=ifort .. |
Intel-optimised builds |
Note
CMake may require manual specification of BLAS/LAPACK locations:
cmake -DBLAS_LIBRARIES=/path/to/libblas.so \
-DLAPACK_LIBRARIES=/path/to/liblapack.so ..Tip
OpenBLAS Support: This programme supports OpenBLAS, which includes LAPACK in the same .so file. However, both libraries must still be passed to CMake for proper linking.
๐ง Ubuntu/Debian
sudo apt-get update
sudo apt-get install gfortran cmake libblas-dev liblapack-dev๐ macOS
brew install gcc cmake openblas lapack๐ฉ Red Hat/CentOS
sudo yum install gcc-gfortran cmake blas-devel lapack-develnuclear-physics-library/
โโโ ๐ฆ core/ # Foundational utilities
โ โโโ kinds.f90 # Precision definitions
โ โโโ constants.f90 # Physical/mathematical constants
โ โโโ numeric_utils.f90 # Numerical utilities
โ โโโ rng.f90 # Random number generation
โ
โโโ ๐งฎ kernels/ # Mathematical methods
โ โโโ linear_algebra/ # Matrix operations
โ โโโ ode/ # ODE solvers
โ โโโ optimisation/ # Optimisation algorithms
โ โโโ pde/ # PDE methods
โ
โโโ โก models/ # Physics models
โโโ burnup_depletion.f90
โโโ cross_sections.f90
โโโ multigroup_diffusion.f90
โโโ two_phase_flow.f90
โโโ fluid_dynamics.f90
โโโ heat_transfer.f90
โโโ nuclear_fission.f90
โโโ pressure_dynamics.f90- โ Fortran compiler (gfortran 9.0+ or Intel Fortran)
- โ CMake 3.20+
- โ BLAS/LAPACK libraries
- ๐ FFTW3 (for optimised spectral methods)
- ๐ MPI (for parallel simulations)
- ๐ OpenMP (for shared-memory parallelisation)
The CMakeLists.txt file provides aggressive optimisation flags:
| Compiler | Flags |
|---|---|
| GNU | -Ofast -march=native -mtune=native -flto |
| Intel | -O3 -xHost |
Tip
For optimal performance, use these BLAS implementations:
- Intel MKL: Best for Intel CPUs
- OpenBLAS: Good general-purpose choice
- ATLAS: Auto-tuned alternative
Example with MKL:
cmake -DBLA_VENDOR=Intel10_64lp ..Contributions are welcome! Please follow these steps:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/amazing-feature) - ๐พ Commit your changes (
git commit -m 'Add amazing feature') - ๐ค Push to the branch (
git push origin feature/amazing-feature) - ๐ Open a Pull Request
| Guideline | Requirement |
|---|---|
| Indentation | 4 spaces |
| Line Length | 100 characters maximum (excluding indentation) |
| Naming | Descriptive variable names |
| Documentation | Comments for complex algorithms |
| Structure | Follow existing module organisation |
This project is licensed under the Apache V2.0 Licence - see the LICENCE file for details.
If you use this library in your research, please cite:
@software{nuclear_physics_library,
title = {Nuclear Physics Library: A Fortran Library for Reactor Simulation},
author = {Stevenson Parker},
year = {2025},
url = {https://github.com/PolskaKrowa/nuclear-physics-library}
}- LAPACK and BLAS developers for linear algebra routines
- The Fortran community for continued language development
- Contributors and users of this library
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- MPI parallelisation for distributed computing
- Python bindings via f2py
- I/O and Visualisation (HDF5, VTK, etc.)
- Reactor control modules
- Material Properties database
- Detailed fuel modelling
- Enhanced testing suite (unit tests, benchmarks, verification tests)
- Additional reactor geometries (hexagonal, cylindrical)
- Advanced turbulence models
- OpenMP threading for shared-memory systems
- Improved performance for real-time/faster-than-real-time simulation
v0.2.0 (current)
- Enhanced neutronics models
- Improved fluid dynamics simulation
- Consistent testing suite
v0.1.0
- Initial release
- Core utilities and mathematical kernels
- Basic physics models (fluid, heat, fission, pressure)
- Single-threaded implementation
Note: This library is intended for educational and research purposes.
Made with โค๏ธ and ๐ง by Steve