-
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 bug in SA-neg diffusion term (and generalize indices of flow variables for use by scalar solvers and numerics) #1392
Conversation
This pull request fixes 1 alert when merging ac3f474 into 147dfac - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging 9790d11 into 147dfac - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging 60eed7c into 147dfac - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging 40c5586 into 147dfac - view on LGTM.com fixed alerts:
|
nu_e = nu_ij + fn*nu_tilde_ij; | ||
} | ||
|
||
Flux[0] = nu_e*Proj_Mean_GradScalarVar[0]/sigma; |
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.
There was a bug here for SA-neg as it was using the "uncorrected flux" which is prone to odd-even decoupling.
To keep track of this I've changed the scope of the PR.
The intrusive part of the changes (for @TobiKattmann and @suargi ) is done, so if it is ok with you I propose merging this now, to use it also in the species solver and refactored SA sources.
@WallyMaier please continue the NEMO turbulence in another PR, it should work out of the box now.
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'll give this PR a read later today 👍
Density_i = V_i[nDim+2]; | ||
Laminar_Viscosity_i = V_i[nDim+5]; | ||
} | ||
Density_i = V_i[idx.Density()]; |
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 kept the sources cpp instead of moving to the hpp only to highlight the changes for @suargi , eventually it should be in an hpp to avoid the explicit instantiations (bottom of the file).
This pull request fixes 1 alert when merging f7d054e into 147dfac - view on LGTM.com fixed alerts:
|
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 thanks for taking this over. It was much needed and I was dragging my feet. Ill work to make the necessary NEMO changes in another PR. I can't approved but LGTM.
} | ||
} else { | ||
for (unsigned short iDim = 0; iDim < nDim; iDim++) { | ||
q_ij += 0.5 * (V_i[iDim + idx.Velocity()] + V_j[iDim + idx.Velocity()]) * Normal[iDim]; |
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.
👍
@@ -41,6 +41,7 @@ CNEMOEulerVariable::CNEMOEulerVariable(su2double val_pressure, | |||
const CConfig *config, | |||
CNEMOGas *fluidmodel) | |||
: CFlowVariable(npoint, ndim, nvar, nvarprim, nvarprimgrad, config), | |||
indices(ndim, config->GetnSpecies()), |
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.
👍
@@ -355,7 +355,7 @@ def main(): | |||
turb_naca0012_sa.cfg_dir = "rans/naca0012" | |||
turb_naca0012_sa.cfg_file = "turb_NACA0012_sa.cfg" | |||
turb_naca0012_sa.test_iter = 10 | |||
turb_naca0012_sa.test_vals = [-11.133933, -14.498178, 1.064330, 0.019756, 20, -1.898609, 20, -2.719825] | |||
turb_naca0012_sa.test_vals = [-8.629583, -10.377793, 1.064488, 0.019711, 20.000000, -2.173971, 20.000000, -5.213344] |
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 idea why plain old SA would see such a change?
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.
it's SA-neg for which the bug was fixed
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.
It seems that the regression tests introduced in #1418 have passed, in particular in parallel_regression.py therer is a regression test for the negative SA. This means that this regression test is not properly defined and should be improved. Wonder about the others.
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 @WallyMaier and @pcarruscag for this. No more guessing what e.g V_i[nDim+2]
now actually is 👍
I think the changes I have to make to #1388 are somewhat clear (after all, I can follow the Turbulence example :) )
So LGTM
su2double Flux[MAXNVAR]; /*!< \brief Final result, diffusive flux/residual. */ | ||
su2double* Jacobian_i[MAXNVAR]; /*!< \brief Flux Jacobian w.r.t. node i. */ | ||
su2double* Jacobian_j[MAXNVAR]; /*!< \brief Flux Jacobian w.r.t. node j. */ | ||
su2double JacobianBuffer[2*MAXNVAR*MAXNVAR]; /*!< \brief Static storage for the two Jacobians. */ |
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 great static-ification of SU2 👍
Co-authored-by: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com>
This pull request fixes 1 alert when merging 57a736a into 147dfac - view on LGTM.com fixed alerts:
|
Thank you for the reviews folks, no feet were dragged, I was just looking for a relaxed Sunday activity. |
Introduced in #1392. The porting approach for now was to simply to way it was done for turbulence. For the species_sources one could and should prob adopt the approach for convection/diffusion. But for ease of merging that was not done yet.
@@ -641,7 +641,7 @@ def main(): | |||
turbmod_sa_neg_rae2822.cfg_dir = "turbulence_models/sa/rae2822" | |||
turbmod_sa_neg_rae2822.cfg_file = "turb_SA_NEG_RAE2822.cfg" | |||
turbmod_sa_neg_rae2822.test_iter = 20 | |||
turbmod_sa_neg_rae2822.test_vals = [-2.004688, 0.742320, 0.497307, -5.265640, 0.809478, 0.061986] | |||
turbmod_sa_neg_rae2822.test_vals = [-2.004689, 0.742306, 0.497308, -5.265793, 0.809463, 0.062016] | |||
turbmod_sa_neg_rae2822.su2_exec = "mpirun -n 2 SU2_CFD" |
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.
It did not pass @suargi
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.
My bad. Thanks!
Proposed Changes
This draft PR aims to generalize and template the turbulence solver/ scalar solvers to reduce code duplication and allow NEMO access to the turbulence solvers. The ideas were discussed with @pcarruscag, @TobiKattmann and @suargi,
I am opening up the draft PR very early, so this is very much a work in process.
The main idea is use templates to introduce differing variable index values into the Scalar/Turb solvers.
Related Work
This idea follows PR #1375 and PR #1330
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.