Fix CUSTOM_OBJFUNC and TAVG_CUSTOM_OBJFUNC missing from historyMap#2747
Closed
Ovocode05 wants to merge 1 commit intosu2code:masterfrom
Closed
Fix CUSTOM_OBJFUNC and TAVG_CUSTOM_OBJFUNC missing from historyMap#2747Ovocode05 wants to merge 1 commit intosu2code:masterfrom
Ovocode05 wants to merge 1 commit intosu2code:masterfrom
Conversation
Member
|
There is a PR open, you can see what are the issues there #2587 |
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.
Fix: Add CUSTOM_OBJFUNC and TAVG_CUSTOM_OBJFUNC to historyMap.py
Fixes Issue
#2586 — Custom Objective Function Does not Work with shape_optimization.py
Root Cause
historyMap.pyis the bridge between the C++ solver output and the Pythonoptimization framework. Every objective function used in
shape_optimization.pymust have a corresponding entry in this map. The entry tells Python:
COMBO,AERO_COEFF)CUSTOM_OBJFUNCwas never added to this map, despite being fully implementedin C++ since v7.0.
Test Case
Tested using
TestCases/optimization_euler/steady_naca0012/inv_NACA0012_basic.cfgwith the following custom objective (p-norm of surface pressure):
CUSTOM_OUTPUTS= 'P50_avg : AreaAvg{pow(PRESSURE,50)}[airfoil]; P_pnorm50 : Function{pow(P50_avg, 1.0/50.0)}' CUSTOM_OBJFUNC= 'P_pnorm50' OBJECTIVE_FUNCTION= CUSTOM_OBJFUNC OPT_OBJECTIVE= CUSTOM_OBJFUNC * 1.0How to Run
cd TestCases/optimization_euler/steady_naca0012/ python SU2_PY/shape_optimization.py -g DISCRETE_ADJOINT -f inv_NACA0012_basic.cfgBefore Fix
Crashes immediately — no simulation runs at all.
After Fix
Full optimization loop completes successfully.
Related Issues