Skip to content
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

Update of SU2-Python 3.0 #1363

Merged
merged 6 commits into from
Aug 27, 2021
Merged

Update of SU2-Python 3.0 #1363

merged 6 commits into from
Aug 27, 2021

Conversation

Nicola-Fonzi
Copy link
Contributor

Proposed Changes

Sorry for the separate PR... we are working to include more solid solvers that can be used with the interface. This PR introduces few modifications that are required to include other solvers.

PR Checklist

  • 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.

Copy link
Contributor

@TobiKattmann TobiKattmann left a comment

Choose a reason for hiding this comment

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

No need to be sorry for separate PR's @Nicola-Fonzi . Generally merging smaller sized chunks is better for everyone (although there is a limit at some point ;) ).

Just a few comments. But be aware: I am neither any knowledgable in python or CSD 🐌


if self._ConfigContent["MAPPING_MODES"] == "YES" and self._ConfigContent["CSD_SOLVER"]!="NATIVE":
self._ConfigContent["CSD_SOLVER"]="NATIVE"
print("WARNING: It has been requested to map modes, but the native solver was not selected. It is being selected automatically")
Copy link
Contributor

Choose a reason for hiding this comment

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

Concerning these screen-output-warnings: I personally think errors are the best warnings :) . Warnings disappear in the overall screen-output like hide-and-seek-champions. Setting or altering options based on the other (or because they were not set) can be dangerous. One thinks the config is the one ruling them all whilst in fact has no power over here at the code.

So instead
altering an option: error and say what should be done by the user or why that combination doesn't make sense
setting an option: error and require the user to make a choice

There are moments where that kind of stuff is reasonable, so that is up to you whether you error or warn. Maybe erroring helps you down the road as well. E.g. you actually wanted to set MAPPING_MODES to Yes and simply lost track of commented in/out options during debugging and then you wonder why the results are the way they are (that is of course a totally made up example ;) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. I changed the print in raise exception. Please note that the very first two cases are actually just default values for non-compulsory keywords. I will add a proper parser at a certain point...

Comment on lines +117 to +121
if CSD_Solver in ["NATIVE"]:
if myid == rootProcess:
print("\n")
print(" Initializing solid solver ".center(80,"*"))
if CSD_Solver == 'NATIVE':
Copy link
Contributor

Choose a reason for hiding this comment

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

With my first graders python knowledge: Arent line 117 and 121 equivalent/redundant right now? I guess in the list in line 117 you would incorporate more solvers in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is redundant but ready for other solvers to be added. 117 will be a list of supported serial solvers, then you have to import a different module for each of them. In this case there is only the one in 121

@@ -113,22 +113,22 @@ def main():
comm.barrier()

# --- Initialize the solid solver --- # (!! for now we are using only serial solid solvers)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please transform those kinds of intermediate comments into serious ones for PR's (although this was not changed/done in this PR)

Suggested change
# --- Initialize the solid solver --- # (!! for now we are using only serial solid solvers)
# --- Initialize the solid solver --- #
# --- For now, only serial solid solvers are used. --- #

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I sometimes forget about them. Sorry about that

Comment on lines 129 to 131
# Parallel solvers
else:
SolidSolver = None
raise Exception('\n Invalid solid solver option')
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@Nicola-Fonzi Nicola-Fonzi merged commit 76fa1e9 into su2code:develop Aug 27, 2021
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.

2 participants