-
Notifications
You must be signed in to change notification settings - Fork 918
[WIP] Fixes to axi nemo set functions and auxvargrad in source residual #1205
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
Conversation
…rection in nemo axisymmetric source residual, fixed fluid model/transport model print statement Signed-off-by: jtneedels <jneedels@stanford.edu>
WallyMaier
left a comment
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 fixing these issues, @jtneedels. Ill let someone else check, but LGTM.
| // Do not remove. | ||
|
|
||
| /*--- Set volume ---*/ | ||
| numerics->SetVolume(geometry->nodes->GetVolume(iPoint)); |
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.
I think this is fine. We might need to look into a way to avoid repeating "set" functions in the future.
Signed-off-by: jtneedels <jneedels@stanford.edu>
| ModelTable.AddColumn("Mixture", 25); | ||
| ModelTable.AddColumn("Transport Model", 25); | ||
| ModelTable.AddColumn("Fluid Model", 25); | ||
| ModelTable.AddColumn("Transport Model", 25); |
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 aligning these!
Signed-off-by: jtneedels <jneedels@stanford.edu>
| // TODO: NOTE: Some of these are set above. They need to be set here as well, otherwise they are passed in incorrectly. | ||
| // Do not remove. | ||
|
|
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.
This is not something that just happens.
Most likely scenario is that you have a memory leak, which should be easy to find with valgrind.
Compile a debug or debugoptimized version, choose a small testcase that uses this feature, run
valgrind SU2_CFD your_config.cfg
see where it leads you.
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.
Any luck @jtneedels ? We were planning to release 7.1.1 but we can also wait a little more.
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.
@pcarruscag I haven't resolved it yet, but I am working on it more today. What is the timeline for the version 7.1.1 release? I don't want to hold it up.
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.
We don't have strict deadlines but we try to have these maintenance releases every month.
This month is shorter, so if you want a specific day lets say Monday.
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.
Okay sounds good. I'm definitely seeing a memory leak, and a number of uninitialized warnings in CNEMOEulerVariable.cpp and CNEMOEulerSolver.cpp. Still working on finding what's causing this specific issue.
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.
Hi Pedro, I'm having trouble pinning down the memory leak causing the issue, but it looks like it might be coming from the Auxvar_grad terms used in the source residual. I'm having trouble getting specific line numbers when running valgrind with: valgrind --leak-check=full --track-origins=yes SU2_CFD testcase.cfg and compiling with debugoptimized. Is there anything I need to add to my run command?
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.
debug instead of debug optimized might give more information... I do not know of anything else you may add.
Some of those warnings are infectious in that if something is not initialized all dependent quantities will also be a warning.
You need to start fixing from the top down. And then because of how the numerics (in general not just NEMO) are implemented the bug might be due to something else...
| residual[iSpecies] -= 0.0; | ||
| residual[nSpecies] -= Volume*(yinv*total_viscosity_i*(PrimVar_Grad_i[nSpecies+2][1]+PrimVar_Grad_i[nSpecies+3][0]) | ||
| -TWO3*AuxVar_Grad_i[0][0]); | ||
| residual[nSpecies+1] -= Volume*(yinv*total_viscosity_i*2*(PrimVar_Grad_i[nSpecies+3][1]-v*yinv) |
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.
... for example in line 365 above (sumJhs_y += (rho*Ds[iSpecies]*GV[RHOS_INDEX+iSpecies][1] - V_i[RHOS_INDEX+iSpecies]*Vector[1]) * hs[iSpecies];) and also 366, where is Vector[1] populated?
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.
Its populated in CNEMONumerics.cpp, should I try repopulating it in NEMO_sources?
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.
In GetViscousProjFlux? How does that value make its way into CSource_NEMO::ComputeAxisymmetric ?
Within each application of a public numerics method (like ComputeAxisymmetric or ComputeResidual) you need to be able to trace the result to the inputs, i.e. the things that are set into numerics from the outside before calling the method, or to the constructor, e.g. some constant that is stored in the constructor.
Otherwise you are computing things for one point based on values of another point.
This pattern we have in SU2 in general of "setting" followed by "compute" with very "stateful" objects (i.e. full of member variables used for intermediate results) is not very manageable unfortunately.
We have been getting away with it because most of these class hierarchies are simple, but for richer physics it is going to be headache after headache...
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.
Yeah exactly in GetViscousProjFlux. So in cases like this, where there aren't set/compute functions I can just call to update the value, would the best remedy be to explicitly recompute Vector in CSource_NEMO::ComputeAxisymmetric?
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.
Whenever you find yourself needing to do the same action in more than one location, make it a function.
Functions should have clear inputs and outputs.
Programming via side effects, i.e. you call a method of a class and it does some magic to a member variable that you use afterwards is a bad pattern.
The safeties the language offers to keep us from using that pattern are const and static qualifiers. const methods can only read from member variables, static can only use other static methods/variables.
"Make everything you can const" (every C++ author ever)
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions. |
fixed set functions for NEMO axisymmetric, implemented auxvargrad correction in nemo axisymmetric source residual, fixed fluid model/transport model print statement
Signed-off-by: jtneedels jneedels@stanford.edu
Proposed Changes
This PR addresses an issue found with not setting primitive and conservative variables in computing the axisymmetric source residual, as well as implementing the auxvargrad indexing correction applied in the standard air axisymmetric source residual and fixing an issue with printing the fluid and transport models.
Related Work
This PR is related to #1192 and #1162.
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.