-
Notifications
You must be signed in to change notification settings - Fork 904
[WIP] defect correction of Nishikawa for skewed meshes #2584
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?
Conversation
| switch (correct) { | ||
| case VISCOUS_GRAD_CORR::EDGE_NORMAL: | ||
| diss = proj_vector_ij / max(dist_ij_2,EPS*EPS); | ||
| break; | ||
| case VISCOUS_GRAD_CORR::FACE_TANGENT: | ||
| diss = Area2 / max(proj_vector_ij,EPS); | ||
| break; | ||
| case VISCOUS_GRAD_CORR::ALPHA_DAMPING: | ||
| const su2double alpha = 4.0 / 3.0; | ||
| diss = alpha * Area2 / max(abs(proj_vector_ij),EPS); | ||
| break; | ||
| } |
Check warning
Code scanning / CodeQL
Missing enum case in switch Warning
NONE
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the problem, all enum members of VISCOUS_GRAD_CORR used in the switch statement should be handled explicitly or, alternatively, a default case should be added. The best way to proceed here is to add a case for VISCOUS_GRAD_CORR::NONE to document intent and control the handling for this value. If NONE should have specific behavior, provide the logic; otherwise, you can make it explicit that nothing should be done (e.g., leave diss at 0.0). Adding a comment may further clarify intent.
Make this change directly in the ComputeProjectedGradient function, at the switch statement on correct (lines 676–687).
-
Copy modified line R684 -
Copy modified lines R687-R689
| @@ -681,9 +681,12 @@ | ||
| diss = Area2 / max(proj_vector_ij,EPS); | ||
| break; | ||
| case VISCOUS_GRAD_CORR::ALPHA_DAMPING: | ||
| const su2double alpha = 4.0 / 3.0; | ||
| const su2double alpha = 4.0 / 3.0; | ||
| diss = alpha * Area2 / max(abs(proj_vector_ij),EPS); | ||
| break; | ||
| case VISCOUS_GRAD_CORR::NONE: | ||
| // No correction applied; diss remains 0.0 | ||
| break; | ||
| } | ||
|
|
||
| //proj_vector_ij /= max(dist_ij_2,EPS); |
| break; | ||
| } | ||
|
|
||
| //proj_vector_ij /= max(dist_ij_2,EPS); |
Check notice
Code scanning / CodeQL
Commented-out code Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
To fix the problem, we should remove the commented-out code on line 689: //proj_vector_ij /= max(dist_ij_2,EPS);. We should not replace it with any alternative code nor attempt to integrate it unless its function is necessary, as there is no indication in the comment or surrounding code that it should be reinstated or has a continuing purpose. The change only involves deleting the line, and no additional definitions, imports, or method changes are required. Only SU2_CFD/include/numerics/CNumerics.hpp, at the flagged location, needs to be updated.
| @@ -686,7 +686,6 @@ | ||
| break; | ||
| } | ||
|
|
||
| //proj_vector_ij /= max(dist_ij_2,EPS); | ||
|
|
||
| /*--- Mean gradient approximation. ---*/ | ||
| for (int iVar = 0; iVar < nVar; iVar++) { |
| const su2double gasConst; | ||
| const su2double prandtlTurb; | ||
| const bool correct; | ||
| //const su2double cp; |
Check notice
Code scanning / CodeQL
Commented-out code Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
The best way to fix this problem is to remove the commented-out code line //const su2double cp; entirely. This avoids introducing confusion for future readers and adheres to clean code principles. No additional imports, method definitions, or code changes are required. Only the specific line in the file needs to be deleted, with surrounding context left unchanged.
| @@ -77,7 +77,6 @@ | ||
| const su2double gamma; | ||
| const su2double gasConst; | ||
| const su2double prandtlTurb; | ||
| //const su2double cp; | ||
| const bool correct_EN; | ||
| const bool correct_FT; | ||
| const bool correct_AD; |
|
Hi Nijso,
I will keep you up-to-date in this thread and I will open a more thorough PR when the branch feature_2ndOrderMixedGrids is ready (I have some restructuring/clean-up to do as well as additional tests to run) |
|
Hey Tommaso, |
|
Hi @tbellosta, I started this PR to get things rolling again, because development seemed to have stalled and I think these are great developments that can really push the accuracy and robustness forward. To make it easier to get these developments into develop, I suggest to separate the 4(?) main ideas: this defect correction, the flux correction, the control volume computation and the modified Roe scheme as was also mentioned by Pedro. |
Proposed Changes
Give a brief overview of your contribution here in a few sentences.
correction of eq. 7 and 8 in:
https://www.researchgate.net/publication/387963120_Enhancing_Accuracy_in_Mixed-Element_Grids_and_Convergence_on_Skewed_grids_for_the_Two-Dimensional_Edge-Based_Compressible_Navier-Stokes_Solver
alpha damping from Nishikawa:
https://www.researchgate.net/publication/318535481_Effects_of_High-Frequency_Damping_on_Iterative_Convergence_of_Implicit_Viscous_Solver
Taken from the branch feature_2ndOrderMixedGrids
pre-commit run --allto format old commits.