-
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
Fix for discrete adjoint: axisymmetry + SST turbulence model #1571
Conversation
…esidual of SST model.
AD::SetPreaccIn(Coord_i[1]); | ||
AD::SetPreaccIn(V_i[2]); |
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.
Thank you for the fix, this is probably something I broke recently.
Can you add a simple regression test case? It can be a pipe or something very small, just enough to prevent this in the future.
There is an issue opened for the SA problem you mention #1565, we should check for this in CConfig::SetPostprocessing and throw an error (if axisymetry and the turbulence model is not NONE, SST, or SST_SUST).
Oh and last thing, add yourself to AUTHORS.md |
Replacing hardcoded 2 in velocity preaccumulation Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
Thanks for the fast reply! I changed the hardcoded 2 (just as a remark: the hardcoded values also appear in the calculations), added myself as an author and inserted some lines for throwing an error if the issue in #1565 occurs. I did not know exactly where to put it best. Concerning a regression test: I strongly support the idea of introducing an axisymmetric regression test. However, I was using a testcase from @bigfooted , and I never set up such a test case on my own. There do not seem to be any axisymmetric pipe setups in the Testcases folder so far. @bigfooted , could we maybe use your mesh for the jet flow test case and, if necessary, switch to a standard flow setup? |
Yep that's what I meant, replace it in the calculations as well please, and also in PrimVarGrad, the leading 2 is "velocity + 1" and the leading one is "velocity". |
We have some small flat plates here and there, I can convert one to axisymmetric. |
Okay, done. Sorry, I read over that comment before. Hope I picked the correct component in PrimVarGrad. |
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.
That's perfect thanks.
I had a look in the testcases and there is an axisym sst regression for the primal solver, in TestCases/axisymmetric_rans/air_nozzle.
It has a restart file already (in the TestCases repo), so it should be easy to add a regression to parallel_regression_AD.py
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.
Everything else LGTM, thanks again.
Yes, you can use that mesh. It can be used for pipe flow setup and jets with coflows, so we can reuse it in different testcases as well if needed. But any simple rectangular mesh is fine, so a mesh from the existing testcases as @pcarruscag mentions would also work. |
I was aware of that test case. But I did not use it for the verification of sensitivities since I could not manage to set up a working derivative computation (different combination of markers/objective functions were leading to a memory error). However, I could use it to set up a regression test for the comparison of residuals. |
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.
Where did you get memory errors? SU2_DOT_AD?
Sorry for the confusion. I must have mixed something up yesterday - the test case was crashing directly for SU2_CFD_AD when I set MARKER_MONITORING. But now it is working. So I think we can stick to the regression case and the way I set it up. Thanks again for the reviews! |
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.
Thanks for this fix Lisa 💐 The code bits look good to me.
When it comes to the cfg I much prefer (and that is also a bit current SU2 strategy) stripping all the comments away instead of a few ones you want to highlight. This cfg is of course very close to an existing one and I am wondering whether we can make both cases work with just one cfg.
The first step would be to not remove MATH PROBLEM
as then the usage of SU2_CFD or SU2_CFD_AD indicates primal or adjoint.
The second step is to get rid of the restart which I guess we could do with this part from Testcase.py
# Indicate whether to disable restart
self.no_restart = False
Did you change any other options? If not I guess this is the way how we could avoid duplicating the cfg. So it might be more appropriate to not apply the suggestions here on github but to do it on your machine and test it, and if it works push 👍
This is confusing me a bit. Before I set it up: Do you want me to use the original config (without the _adj), remove the comments and the model and then run SU2_CFD_AD in the regression test? |
In the first instance I would just try to run the new and original Testcase with just the original config. And from what I can see you need to do the 2 steps mentioned above (Remove In a next step (which is then more of a cosmetic, optional nature) you could strip the comments and unnecessary options from the cfg |
27d35a2 -> awesome. Concerning the option(-comment) stripping; I am still in favor, although @FlorianDm is the original author. Especially I would strip the But for the sake of keeping this PR concise the current state is fine as well 👍 |
Proposed Changes
The velocity component used in the axisymmetric residual is now considered as an input for preaccumulation in the residual computation. When not considered, the use of axisymmetry and the SST model will result in wrong sensitivities when using the discrete adjoint method.
I also wanted to note that there does not seem to be any treatment of axisymmetric cases for the SA model. Is this correct or does it make sense to include a warning? We could, for example, do that in the context of this pull request.
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.