A collection of phase-field simulation codes for modeling pure melt solidification using both CPU and GPU implementations.
This repository contains four phase-field simulation applications:
- Kobayashi Model - Implementation of the Kobayashi phase-field model for dendritic solidification
- Physical Model - Physically-based phase-field model with realistic material parameters
Each model is available in both CPU (OpenMP) and GPU (CUDA) implementations.
- 3D phase-field simulations
- CPU implementations with OpenMP parallelization
- GPU implementations using CUDA
- VTK output for visualization
- Modern C++17/CUDA standards
- CMake and Makefile build systems
- C++ compiler with C++17 support (GCC 7+, Clang 5+, MSVC 2017+)
- OpenMP support (optional, for parallel execution)
- CMake 3.18+ (for CMake builds) or GNU Make
- NVIDIA CUDA Toolkit 11.0+
- GPU with Compute Capability 7.0+ (Volta architecture or newer)
- C++ compiler compatible with your CUDA version
CMake provides a unified build system for all applications:
# Create build directory
mkdir build && cd build
# Configure (CPU and GPU if CUDA is available)
cmake ..
# Build all applications
cmake --build .
# Or build specific applications
cmake --build . --target KobayashiCPU
cmake --build . --target KobayashiGPU
cmake --build . --target PhaseFieldCPU
cmake --build . --target PhaseField # GPU version# Specify build type
cmake -DCMAKE_BUILD_TYPE=Release .. # or Debug
# Specify CUDA architectures (if needed)
cmake -DCMAKE_CUDA_ARCHITECTURES="80;86" ..
# Build with verbose output
cmake --build . --verboseEach application can be built independently using Make:
# Kobayashi CPU
cd apps/kobayashi-cpu
make # Release build
make debug # Debug build
make clean # Clean build artifacts
# Kobayashi GPU
cd apps/kobayashi-gpu
make # Release build
make debug # Debug build
make clean # Clean build artifacts
# Physical CPU
cd apps/physical-cpu
make # Release build
make debug # Debug build
make clean # Clean build artifacts
# Physical GPU
cd apps/physical-gpu
make # Release build
make debug # Debug build
make clean # Clean build artifactsFor GPU builds, you can customize the target architectures:
# Build for specific GPU architectures
make SMS="70 80 86"
# Specify CUDA path if not in default location
make CUDA_PATH=/opt/cudaAfter building, executables are created in their respective directories:
# Run CPU simulations
./apps/kobayashi-cpu/KobayashiCPU
./apps/physical-cpu/PhaseFieldCPU
# Run GPU simulations
./apps/kobayashi-gpu/KobayashiGPU
./apps/physical-gpu/PhaseFieldSimulations generate VTK files for visualization:
Out_PhaseField_*.vtk- Phase field dataOut_Temperature_*.vtk- Temperature field data
These files can be visualized using ParaView, VisIt, or similar tools.
- Domain Size: 128³ (CPU) / 128³ (GPU)
- Parameters: Based on Kobayashi's dimensionless model
- Features: Dendritic growth with anisotropy
- Domain Size: 128³
- Parameters: Realistic material properties (Aluminum)
- Features: Physical units with temperature-dependent properties
PhaseField/
├── CMakeLists.txt # Root CMake configuration
├── README.md # This file
├── LICENSE # License information
├── .gitignore # Git ignore patterns
└── apps/
├── kobayashi-cpu/ # Kobayashi CPU implementation
│ ├── CMakeLists.txt
│ ├── Makefile
│ └── KobayashiCPU.cpp
├── kobayashi-gpu/ # Kobayashi GPU implementation
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── KobayashiGPU.cu
│ ├── wrapper.h
│ └── vtk.h
├── physical-cpu/ # Physical CPU implementation
│ ├── CMakeLists.txt
│ ├── Makefile
│ └── PhaseFieldCPU.cpp
└── physical-gpu/ # Physical GPU implementation
├── CMakeLists.txt
├── Makefile
└── PhaseField.cu
- Ensure OpenMP is enabled for parallel execution
- Adjust
OMP_NUM_THREADSenvironment variable to control thread count - Use Release build for best performance
- Build for your specific GPU architecture for optimal performance
- Ensure sufficient GPU memory is available
- Monitor GPU utilization using
nvidia-smi
# Set CUDA path explicitly
cmake -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc ..# Install OpenMP development package
# Ubuntu/Debian: sudo apt-get install libomp-dev
# macOS: brew install libomp- Ensure your GPU supports the target compute capability
- Update to the latest CUDA toolkit
- Check compiler compatibility with your CUDA version
- C++17 standard for modern C++ features
- CUDA C++17 for GPU code
- OpenMP for CPU parallelization
- Modern CMake practices (3.18+)
# CMake
cmake -DCMAKE_BUILD_TYPE=Debug ..
# Make
make debugThe repository includes automated CI/CD for CPU applications:
- Runs on every push and pull request
- Tests compilation with Make
- Uses standard GitHub Actions runners
- See
.github/workflows/cpp.ymlfor workflow configuration
Contributions are welcome! Please ensure:
- Code follows modern C++17 standards
- GPU code supports compute capability 7.0+
- Documentation is updated as needed
- Code is tested before submission
See LICENSE file for details.
- Kobayashi, R. (1993). "Modeling and numerical simulations of dendritic crystal growth." Physica D: Nonlinear Phenomena.
- Wheeler, A. A., Boettinger, W. J., & McFadden, G. B. (1992). "Phase-field model for isothermal phase transitions in binary alloys." Physical Review A.
- Author: Raphael Schiedung
- Email: raphael.schiedung@rub.de
- Created: November 2015
- Updated: January 2026
This project uses phase-field methods for simulating solidification phenomena in materials science.