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

Enable user to change Mach number and Reynolds Number from Python Interface #2185

Open
kursatyurt opened this issue Dec 15, 2023 · 4 comments

Comments

@kursatyurt
Copy link
Contributor

I want to introduce two new interfaces to change the Freestream Mach number and Reynolds Numbers from the Python interface.

As there are many parameters (mostly non/dimensional) affected by those two values I would like to get your insights on the viability and potential drawbacks of offering such an interface. Your thoughts on this matter would be greatly appreciated.

@pcarruscag
Copy link
Member

You would need to make some changes to the code to ensure that Mach number is always obtained from CConfig, currently we convert mach number to freestream velocity in some solvers and work with that instead.
There are also some convective schemes that store a copy of the Mach number when they are constructed.
Reynolds number would probably be a pain because it may affect quite a few things in SetNonDimensionalization.

@kursatyurt
Copy link
Contributor Author

It looks more complicated than I initially assumed. Without Reynolds's number change, Mach's number change does not make sense. For me, at the moment, it is not worth investing some time in implementation.

@aryan0931
Copy link

You’ll need to enhance the Python wrapper to allow setting these parameters before running simulations. This involves adding new methods to set Mach number and Reynolds number, ensuring they update the configuration, and testing the changes.

My suggestions :

  • Add Methods to Python Wrapper: Modify pySU2.cpp to include set_mach_number and set_reynolds_number methods in the Config class, which call SetOption with the appropriate keys to update the configuration.
  • Ensure Configuration Updates: Verify that setting these parameters triggers any necessary updates, like recalculating derived flow properties, by checking if UpdateDerivedParams() is called after setting values.
  • Test the Changes: Write a Python script to set these parameters (e.g., config.set_mach_number(0.5)) and run a simple simulation, like a 2D airfoil case, to ensure the changes are reflected in the output. Add assertions to verify the parameters are set correctly.

An interesting aspect is ensuring parameter precedence—if a config file is loaded, Python-set values must override file settings, which might require additional logic to handle configuration immutability.

@saumy-sh
Copy link

Hey! This issue seems interesting, and I would like to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants