Removed CSolver::Convective_Residual by maxaehle · Pull Request #1222 · su2code/SU2 · GitHub
Skip to content

Removed CSolver::Convective_Residual#1222

Merged
maxaehle merged 4 commits into
developfrom
fix_remove_convectiveresidual
Mar 8, 2021
Merged

Removed CSolver::Convective_Residual#1222
maxaehle merged 4 commits into
developfrom
fix_remove_convectiveresidual

Conversation

@maxaehle

@maxaehle maxaehle commented Mar 4, 2021

Copy link
Copy Markdown
Contributor

Proposed Changes

Remove CSolver::Convective_Residual, as it does nothing and no derived class overrides it. There is one call in CIntegration.cpp, which I would like to replace by an error message.

Note that in the present version, usage of numerics[CONV_TERM] would not be thread-safe, it should be numerics[CONV_TERM + omp_get_thread_num()*MAX_TERMS] (see also #1214).

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 the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags, or simply --warnlevel=2 when using meson).
  • My contribution is commented and consistent with SU2 style.
  • 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.

Comment on lines 61 to 63

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for going after dead code 👍
It should also be fairly safe to not cover the FINITE_ELEMENT case or just handle default, I doubt the execution will reach here if the wrong integration class is instantiated (multiple things would have to go wrong).
But looks good to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By the way, there is dead code even in SU2_CFD.cpp, the else branch is unreachable: If it were reached, then turbo and harmonic_balance would both be false. As (multizone && !turbo) has to be false, multizone must be false as well. But then ((!multizone && !harmonic_balance && !turbo) || (turbo && disc_adj)) is true ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't touch this until now because I don't understand the principle behind these nested if-statement. Do you think the else branch in SU2_CFD.cpp should be removed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not even going to try unfolding the logic, take it out or throw an error, if the tests pass it's fine by me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🍝

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can even make the constructors of CFluidDriver protected since it is not meant for standalone use anymore (it exists as the base for the legacy drivers).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done in commit 7825b3b

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should also be fairly safe to not cover the FINITE_ELEMENT case or just handle default, I doubt the execution will reach here if the wrong integration class is instantiated (multiple things would have to go wrong).

I agree, commit 42fab4f

and the corresponding clause removed from SU2_CFD.cpp.
If it were reached, then turbo and harmonic_balance would both be
false. As (multizone && !turbo) has to be false, multizone must be
false as well. But then
((!multizone && !harmonic_balance && !turbo)
  || (turbo && disc_adj))
is true.

@TobiKattmann TobiKattmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @maxaehle for removing unused code 👍 Always really valuable to have those cleanups 🧹

@maxaehle

maxaehle commented Mar 8, 2021

Copy link
Copy Markdown
Contributor Author

When the tests have run, I'll ignore this annoying CodeFactor test and merge, right?

@TobiKattmann

Copy link
Copy Markdown
Contributor

@maxaehle maxaehle merged commit 048394c into develop Mar 8, 2021
@maxaehle maxaehle deleted the fix_remove_convectiveresidual branch March 8, 2021 09:43
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.

3 participants