🎉 Congratulations! You have completed this hands-on training on numerical simulations with the samurai library. Throughout these practical sessions, you have progressively built expertise in adaptive mesh refinement techniques and finite volume methods for solving conservation laws.
📚 What You Have Learned¶
Part 0: Environment Setup 🔧¶
You started by setting up your development environment and getting familiar with the tools necessary for computational fluid dynamics simulations. This included installing samurai, configuring compilers, and setting up visualization tools like ParaView.
Part 1: First Steps with samurai 🚀¶
You learned the fundamental concepts of samurai:
Creating multi-resolution meshes in 1D and 2D using
samurai::MRMeshDefining and initializing fields (scalar and vector) on adaptive meshes
Visualizing solutions using both matplotlib and ParaView
Understanding how samurai’s innovative data structure represents meshes as compressed lists of intervals
These foundational skills provided the building blocks for all subsequent work.
Part 2: Naive Burgers Implementation 🌊¶
You implemented your first numerical scheme:
Finite volume method for the inviscid Burgers equation
Time integration using Forward Euler
Multi-resolution adaptation using
samurai::make_MRAdaptRecognizing the limitations of naive implementations on non-uniform meshes
This part highlighted the importance of proper flux handling at interfaces between different refinement levels.
Part 3: Flux Mechanism in samurai ⚡¶
You mastered samurai’s powerful flux mechanism:
Nonlinear flux schemes for conservative formulations
Non-conservative formulations for vector Burgers equations
Linear homogeneous schemes for diffusion operators
Implementing the Taylor-Green vortex as a test case
Combining convective and diffusive operators
This demonstrated how samurai elegantly handles complex multi-dimensional problems with the same code structure across dimensions.
Part 4: Euler Equations 💨¶
You tackled the most challenging problem:
Compressible gas dynamics with the Euler equations
Implementing three Riemann solvers: Rusanov, HLL, and HLLC
Custom boundary conditions for complex geometries (Double Mach Reflection)
Custom prediction operators to ensure physical positivity during refinement
Solving benchmark problems like the 2D Riemann problem and Double Mach Reflection
This final part integrated all your skills: mesh management, flux computation, adaptation strategies, and physical insight.
🎯 Key Skills Acquired¶
By completing this training, you are now able to:
⚙️ Design and implement finite volume schemes for conservation laws using samurai’s flux mechanism
🎛️ Leverage adaptive mesh refinement to optimize computational resources while maintaining accuracy
📐 Handle multi-dimensional problems seamlessly with samurai’s unified framework
🔬 Implement sophisticated Riemann solvers (Rusanov, HLL, HLLC) for compressible flows
🛠️ Create custom operators (boundary conditions, prediction operators) tailored to specific problems
📊 Visualize and analyze simulation results to validate implementations
📝 Work with both conservative and non-conservative formulations of PDEs
💪 The Power of samurai¶
Throughout this training, you experienced the unique advantages of the samurai library:
🗜️ Innovative Data Structure¶
samurai’s compressed interval-based representation enables:
Efficient memory usage for adaptive meshes
Fast set operations for mesh manipulations
Seamless integration of numerical methods
🔗 Flexibility and Extensibility¶
The same flux definition works across all spatial dimensions
Easy integration of custom operators and boundary conditions
Support for both explicit and implicit schemes
📏 Multi-Resolution Capabilities¶
Automatic mesh adaptation based on mathematical error indicators
Multi-resolution analysis independent of the physical equations
Controlled error between fine and adapted solutions
💻 Modern C++ Design¶
Template-based architecture for performance
Lazy evaluation for efficient computations
Clean API that separates mesh management from physics
🔭 Going Further¶
You are now equipped to:
Apply samurai to your own research or industrial problems
Explore more advanced features in the samurai documentation
Contribute to the open-source samurai project on GitHub
Extend the methods learned here to 3D problems and other physical systems
📚 Resources¶
samurai GitHub Repository: https://
github .com /hpc -maths /samurai Documentation: https://
hpc -math -samurai .readthedocs .io/
🙏 Acknowledgments¶
This training material was developed by the HPC-Maths team. samurai is an open-source project that benefits from contributions by researchers and developers worldwide. We encourage you to join the community, share your experiences, and help improve this powerful tool for adaptive mesh refinement.
Special thanks to Ward Haegeman and Giuseppe Orlando for their careful review, valuable suggestions for improvement, and for being the first participants to test this training material. Their feedback was essential to refining the content and exercises.
Thank you for your participation in this hands-on training. We hope you found it valuable and that samurai becomes a useful tool in your numerical simulation toolkit!
If you enjoyed this hands-on training, please consider giving the repository a star on GitHub – it’s the best reward for our efforts! ⭐
For questions, feedback, or support, please visit the samurai GitHub repository or contact the development team.