Fix #2483: Implement field-based restart loading for turbulence solvers by guptapratykshh · Pull Request #2706 · su2code/SU2
Proposed Changes
This PR fixes the crash that occurs when restarting simulations with missing fields in restart files. I've implemented field-based restart loading for turbulence and transition solvers, so you can now restart a RANS simulation from an Euler solution, or switch between turbulence models (e.g., SA to SST) without SU2 crashing.
The implementation uses field name lookup instead of fixed offsets, making restart files more flexible. When a field is missing (like Nu_Tilde when restarting SA from Euler), SU2 now initializes it from defaults and shows a clear warning instead of crashing.
- Added FindFieldIndices() helper to CSolver for batch field lookup using
std::find - Refactored
CTurbSolver::LoadRestart()to support SA and SST models with missing fields - Updated
CTransLMSolver::LoadRestart()for LM transition model compatibility - Created test configs demonstrating Euler → RANS restart workflow
Related Work
Resolves #2483
This addresses the long-standing issue where SU2 would crash when enabling turbulence models or switching between models during restart. The implementation is backward compatible - existing restart workflows continue to work unchanged.
PR Checklist
- I am submitting my contribution to the develop branch.
- My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
- My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
- I used the pre-commit hook to prevent dirty commits and used
pre-commit run --allto format old commits. - I have added a test case that demonstrates my contribution, if necessary.
- I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.