-
Notifications
You must be signed in to change notification settings - Fork 909
fix(SU2_CFD,SU2_PY,Common): Fix typos, code style, and safety guards #2660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix(SU2_CFD,SU2_PY,Common): Fix typos, code style, and safety guards #2660
Conversation
- Fix typo 'approxiations' -> 'approximations' in solver comments - Fix typo 'generilize' -> 'generalize' in CEulerSolver.cpp - Replace type(x) == list with isinstance(x, list) per PEP8 - Add zero-distance guard in CHeatSolver.cpp Heat_Fluxes function - Remove redundant 1.0* multiplication in CRadP1Solver.cpp - Fix float literal 1.0 to integer 1 in CSysMatrix.cpp GPU allocation - Remove redundant 1.0* multiplication in wall_model.cpp Signed-off-by: shbhmexe <[email protected]>
SU2_CFD/src/solvers/CHeatSolver.cpp
Outdated
| dist = sqrt(dist); | ||
|
|
||
| dTdn = (Twall - nodes->GetTemperature(iPointNormal))/dist; | ||
| dTdn = (Twall - nodes->GetTemperature(iPointNormal))/fmax(dist, EPS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary here and in line 671, if the coordinate is the same there are bigger problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! You're right - I've reverted the fmax(dist, EPS) changes on both lines 640 and 671. If the coordinate is the same, that would indeed indicate a bigger problem that should be addressed elsewhere rather than masked by a safety guard here.
|
|
||
| # check for multiple objectives | ||
| multi_objective = type(func_name) == list | ||
| multi_objective = isinstance(func_name, list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are looking into the python scripts, do you think you can help with #2587 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping @pcarruscag . I've taken a look at PR #2587. Since the original author seems inactive, how would you prefer I proceed?
I can verify these changes locally and open a fresh PR with the updates rebased on the latest develop branch if that works best for you. Let me know!
Proposed Changes
This PR addresses code quality issues across the SU2 codebase:
Typo Fixes (Comment-only)
CEulerSolver.cpp(4 occurrences)Python Code Style (PEP8)
type(x) == listwithisinstance(x, list)ingradients.pyandfunctions.pyC++ Safety Improvements
Add zero-distance guard in
CHeatSolver.cpp(lines 640, 671)/distto/fmax(dist, EPS)to prevent potential division by zeroRemove redundant
1.0*multiplication inCRadP1Solver.cpp(lines 323, 397)C++ Bug Fixes (Common)
Fix float literal in
CSysMatrix.cpp(line 160)(nPointDomain + 1.0)to(nPointDomain + 1)for GPU array allocationRemove redundant
1.0*inwall_model.cpp(line 374)Related Work
No related issues. This is a cleanup PR to improve code quality and robustness.
PR Checklist
Impact