Fix DV_VALUE replacement bug in config.py (issue #2005)#2672
Merged
pcarruscag merged 2 commits intosu2code:developfrom Jan 4, 2026
Merged
Fix DV_VALUE replacement bug in config.py (issue #2005)#2672pcarruscag merged 2 commits intosu2code:developfrom
pcarruscag merged 2 commits intosu2code:developfrom
Conversation
- Initialize DV_VALUE_NEW and DV_VALUE_OLD from existing DV_VALUE - Prevents replacement of multi-value DV_VALUE with default [0] - Fixes error: 'DV_VALUE does not contain enough entries to match DV_KIND or DV_PARAM' The bug occurred when DV_VALUE_NEW/OLD were missing - they were initialized to [0] and then overwrote the original DV_VALUE. Now they inherit from DV_VALUE if it exists, preserving the original values.
pcarruscag
approved these changes
Jan 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2005 - Python scripts were replacing multi-value DV_VALUE parameters with zeros, causing solver crashes.
The bug occurred when DV_VALUE_NEW/OLD were missing - they were initialized to [0] and then overwrote the original DV_VALUE. Now they inherit from DV_VALUE if it exists, preserving the original values.
Proposed Changes
This PR fixes a bug in
config.pywhere design variable values were being incorrectly overwritten. The issue was in the initialization logic forDV_VALUE_NEWandDV_VALUE_OLD- they were hardcoded to[0], which would then replace the original multi-valueDV_VALUEparameter.Changes made:
SU2_PY/SU2/io/config.pydata_dict["DV_VALUE_NEW"] = [0]todata_dict["DV_VALUE_NEW"] = data_dict.get("DV_VALUE", [0])data_dict["DV_VALUE_OLD"] = [0]todata_dict["DV_VALUE_OLD"] = data_dict.get("DV_VALUE", [0])Testing:
Verified with the RAE2822 turbulent test case that:
DV_VALUE = 0(incorrect - lost all 6 values)DV_VALUE = 0.02, 0.04, 0.06, 0.08, 0.1, 0.12(correct - preserved all values)Related Work
Closes #2005
This issue was originally reported by @jannav984 who identified the problematic code sections. Credit to them for the investigation work.
PR Checklist
pre-commit run --allto format old commits.