Skip to content

Conversation

@guptapratykshh
Copy link
Contributor

@guptapratykshh guptapratykshh commented Jan 14, 2026

Proposed Changes

Fixed buffer overflow in the Langtry-Menter model where derived variables were incorrectly read from the restart file, causing segmentation faults. This ensures the discrete adjoint solver runs correctly and simulations can be restarted without crashing.

Related Work

Resolves #2606.

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • 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 --all to 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.

@guptapratykshh guptapratykshh changed the base branch from master to develop January 14, 2026 13:04
Copy link
Member

@pcarruscag pcarruscag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please modify one of the LM tests to use a restart file.

Comment on lines 552 to 553
* completes. Previously, this code incorrectly tried to read them from indices [index+2] and [index+3],
* which caused a buffer overflow since only nVar=2 solution variables are stored per point. ---*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary to document what was wrong before, just the present state is enough.

Suggested change
* completes. Previously, this code incorrectly tried to read them from indices [index+2] and [index+3],
* which caused a buffer overflow since only nVar=2 solution variables are stored per point. ---*/
* completes. ---*/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@guptapratykshh guptapratykshh force-pushed the fix/lm-transition-model-adjoint-2606 branch from 79ba3f8 to e7b6a1f Compare January 14, 2026 17:16
Comment on lines 240 to 242
tutorial_trans_flatplate_T3A.test_vals = [-5.808996, -2.070606, -3.969765, -0.277943, -1.953093, 1.708472, -3.514943, 0.357411]
tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.808996, -2.070606, -3.969765, -0.277943, -1.953289, 1.708472, -3.514943, 0.357411]
tutorial_trans_flatplate_T3A.no_restart = True
# Restart test enabled to verify LM transition model restart functionality (issue #2606)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it suspicious that you get the same results after turning on the restart?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, that is exactly what we want to see, the residuals picked up right where they left off instead of resetting, which confirms state loaded correctly

the tiny variation is just standard noise from recomputing derived fields, but fact that it runs stable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

@guptapratykshh guptapratykshh force-pushed the fix/lm-transition-model-adjoint-2606 branch from 0d70a9b to 6023eee Compare January 16, 2026 16:58
Comment on lines 240 to 242
tutorial_trans_flatplate_T3A.test_vals = [-5.808996, -2.070606, -3.969765, -0.277943, -1.953093, 1.708472, -3.514943, 0.357411]
tutorial_trans_flatplate_T3A.test_vals_aarch64 = [-5.808996, -2.070606, -3.969765, -0.277943, -1.953289, 1.708472, -3.514943, 0.357411]
tutorial_trans_flatplate_T3A.no_restart = True
# Restart test enabled to verify LM transition model restart functionality (issue #2606)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

@guptapratykshh guptapratykshh force-pushed the fix/lm-transition-model-adjoint-2606 branch from 9e8d752 to a2758c9 Compare January 17, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assistance with Langtry-Menter Transition Model (LM) Error in SU2

3 participants