r/ScientificComputing • u/TheMakpu • Apr 29 '26
Heat2D: a C++ heat equation solver in 2D
https://github.com/paurierap/heat-2DHi all!
I recently built a small C++ project to solve the generalized heat equation in 2D rectangular domains, mainly as a way to better understand PDE solver design and experiment with separating between spatial discretization and time integration.
The architecture of the project is modular:
- Spatial discretization (currently finite differences with Eigen sparse matrices)
- Time integration (Explicit/Implicit Euler, Crank–Nicolson)
The idea is to make it easy to plug different methods in each part (I’m planning to add finite elements soon). There are also a few example simulations (moving heat source, colliding pulses, etc.) with GIFs in the README.
I’d really appreciate some feedback, especially on:
- The overall design/architecture
- Performance considerations
- Whether this approach makes sense vs more template-heavy designs
5
u/glvz Apr 29 '26
You could look into GridAp Written in Julia to get a sense of the architecture. This looks nice. Have you profiled the code? What's the bottleneck