-
Notifications
You must be signed in to change notification settings - Fork 849
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
Python interface for updating translation and rotation rates of the moving frame #2024
Python interface for updating translation and rotation rates of the moving frame #2024
Conversation
It sounds like you are using an older commit of develop as a base branch, could you please resolve the conflicts? |
OK, I see that some refactoring happened e.g. to the python wrapper in the meantime. What's the best way to resolve the conflicts? --> If I hit the Resolve conflicts button, there is nothing I can do. |
Sorry, mistakenly I removed your functions from conflicted files github somewhat allow me to solve the conflict but not added any new commit or revert it. Feel free to add them as an additional commit or revert my commit. Normally if you have a merge conflict easiest way is to solve the conflict from your IDE. Pull the latest develop and merge to your branch, while merging you need to resolve the merge conflict. This was an easy case you only have a few conflict, git write conflicts ass
your need to replace that part with whichever code you want to keep or delete both of them etc. Then mark from the top right corner as resolved. I am sorry, I am a bit tired and did not identify your part of the code from the previous implementation since it is in the middle. I removed all of them and GitHub automatically push it. The required code pieces are these if I am not wrong. I am really sorry about the mistake. from ////////////////////////////////////////////////////////////////////////////////
/* Functions related to dynamic mesh */
////////////////////////////////////////////////////////////////////////////////
void CDriver::SetTranslationRate(passivedouble xDot, passivedouble yDot, passivedouble zDot) {
if (rank == MASTER_NODE) {
cout << endl << " Setting new translational velocity in x, y, z direction.";
}
for (iZone = 0; iZone < nZone; iZone++) {
config_container[iZone]->SetTranslation_Rate(0, xDot);
config_container[iZone]->SetTranslation_Rate(1, yDot);
config_container[iZone]->SetTranslation_Rate(2, zDot);
}
}
void CDriver::SetRotationRate(passivedouble rot_x, passivedouble rot_y, passivedouble rot_z) {
if (rank == MASTER_NODE) {
cout << endl << " Setting new angular velocity about x, y, z axes.";
}
for (iZone = 0; iZone < nZone; iZone++) {
config_container[iZone]->SetRotation_Rate(0, rot_x);
config_container[iZone]->SetRotation_Rate(1, rot_y);
config_container[iZone]->SetRotation_Rate(2, rot_z);
}
} and from ``SU2_CFD/include/drivers/CDriver.hpp) /*!
* \brief Set the dynamic mesh translation rates.
* \param[in] xDot - Value of translational velocity in x-direction.
* \param[in] yDot - Value of translational velocity in y-direction.
* \param[in] zDot - Value of translational velocity in z-direction.
*/
void SetTranslationRate(passivedouble xDot, passivedouble yDot, passivedouble zDot);
/*!
* \brief Set the dynamic mesh rotation rates.
* \param[in] rot_x - Value of Angular velocity about x-axes.
* \param[in] rot_y - Value of Angular velocity about y-axes.
* \param[in] rot_z - Value of Angular velocity about z-axes.
*/
void SetRotationRate(passivedouble rot_x, passivedouble rot_y, passivedouble rot_z);
|
c2707b0
to
aa786d8
Compare
And where did all the python wrapper functions go?? I see that there is nearly nothing left in the python_wrapper_structure.cpp with respect to version 7.5.1 ? The problem is that I was using several of the functions which are now missing... |
They are in CDriverBase |
feature_python_interface_for_moving_frame
Ok, I see - So where do you think should my new functions go? Now that a bunch of function names changed, I am sure I need to refactor my side as well, so I can't tell if this proposal is still working. |
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.
Please add a python wrapper testcase for this.
Just for completeness, note that changing the grid velocities in an unsteady simulation will not be totally correct with these changes because the acceleration terms (d v_grid / dt) are not being added to the momentum source terms.
the config file via the python wrapper
from preprocessing.
The test case seems to work, I only see small differences in the last digit w.r.t the results I computed on my workstation, which is ok from my side. How can I access the results computed by GitHub? |
TestCases/py_wrapper/updated_moving_frame_NACA12/forces_0_aarch64.csv.ref
Outdated
Show resolved
Hide resolved
Access the solution files? I'm not sure if that is possible, the runners are not persisted after the tests. But updating the results based on the test logs is fine. |
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
python interface, too.
This reverts commit cdd2e61.
b8029b8
to
95628ce
Compare
Thank you @pcarruscag and @kursatyurt for your comments and suggestions! I hope that I understood and applied them as intended, if not, please let me know. This is all new to me and because I'm still learning C++, it took me a few extra commits but now all tests seem to pass :) Have a good weekend! |
Thanks @ArneVoss lgtm |
Thank you @pcarruscag for your help :) |
Just a detail: I noticed that we get the print messages three times now, presumably for all multigrid levels? This is just aesthetic, but is it possible print only the first message and to suppress all following ones? Setting rotating frame grid velocities. |
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.
The following should work
Proposed Changes
Current situation: The translation velocities and rotation rates of a moving frame (activated with GRID_MOVEMENT= ROTATING_FRAME) can only be set in the config file using parameters TRANSLATION_RATE and ROTATION_RATE. During a trim analysis of a free-flying aircraft, these parameters are modified until an equilibrium is achieved.
Problem: A change of these parameters requires a new initialization of the solver, which can be time-consuming depending on the mesh size.
Proposed solution: A python interface is implemented that allows to change the parameters on-the-fly. The grid velocities are updated before a new iteration.
Related Work
This is an extension to pull request #1621.
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.