-
Notifications
You must be signed in to change notification settings - Fork 841
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
Refactoring of convective numerics classes #691
Refactoring of convective numerics classes #691
Conversation
…rruscag/SU2 into refactor_convective_numerics
Hi Pedro, |
Hi Wally, |
Hi Pedro, It is indeed a good idea to keep similar schemes (with minor variations) under one umbrella, especially central scheme as only the dissipation term calculation differs.
Best |
Hi Pedro, Thanks for sharing the nice idea. If it helps in ramping up the CFL than really good.... One query - generally how Jacobian computation by finite difference or AD tend to be in comparison to analytical Jacobians in terms of cost (time). Probably Analytical jacobians are more efficient but they are difficult to compute for a given scheme (is this mostly true?). Thanks |
Hi Amit, |
Hi Pedro, SU2 Testcase repo has 3 supersonic TestCases under euler folder (wedge, biparabolic and bluntbody), they all go well without initialization (you may be already aware of these euler cases). But I do not have any specific supersonic case for RANS or Laminar flow problems (some of them ideally be like nozzle flow or SHOCK-BL interaction). Best |
Ok, I will start with those when I have a minute. |
@pcarruscag @aeroamit I do not have a good test case. But am currently looking for one. Let me know if y'all find a good. |
…om/pcarruscag/SU2 into feature_improve_jacobian_condition
All for improving the abstractions if possible. We did something similar for the scalar upwinding and the viscous schemes already. My only comments, which you can probably guess already, are to make sure we don't take a large performance hit by adding more layers (for example, one can make an argument to remove the entire set of CNumerics classes and implement the methods more efficiently directly in the solver class with vectorization, etc) and that we maintain the flexibility for folks to quickly add new convective schemes which was the original motivation for the existing structure (and more layers could complicate this). Sounds like you're already considering these things, but it is important to find the right balance. |
…ork on the default mode of operation (Roe Jacobian)
Gamma = config->GetGamma(); | ||
Gamma_Minus_One = Gamma - 1.0; | ||
|
||
roe_low_dissipation = val_low_dissipation; | ||
|
||
Diff_U = new su2doub |
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 Bogeyman came for the Roe classes. Roe, L2Roe, and LMRoe now share a parent that implements the fc_{1/2} = kappa*(fc_i+fc_j)*Normal
part, the rest is then done by the derived classes. And with this I concluded this type of refactoring.
|
||
/*--- Compute the residual ---*/ | ||
|
||
for (iVar = 0; iVar < nVar; iVar++) | ||
val_residual[iVar] += (0.5*Nu_c*Diff_U[iVar] + 0.5*Beta*Diff_Flux[iVar])*Area; | ||
val_residual[iVar] = 0.5*((1.0+Beta)*ProjFlux_i[iVar] + (1.0-Beta)*ProjFlux_j[iVar] + Nu_c*Diff_U[iVar])*Area; | ||
|
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.
As discussed in #705, according to the literature the CUSP flux should be expressed as the average of the left and right fluxes plus the artificial diffusion part, and not as a flux of averages + diffusion. This way the scheme becomes 100% upwind above Mach 1, and as a bonus the implementation also becomes more efficient.
Whatever I could do to reduce duplication and improve convergence is done, this PR is ready for reviews.
Hi Pedro, Do you know why this PR is failing during Travis? I looked at the test cases and both are unsteady using Roe? |
Hi Eduardo, |
@EduardoMolina |
Hi @pcarruscag |
Hi @EduardoMolina , |
Hi @pcarruscag , Sorry for the late response. I went through all your implementation and performed some tests. Although, I didn't see an improvement using the accurate jacobians in the subsonic test cases, as already mentioned here, and even in the transonic OneraM6 case from the repo. This implementation is very clean and in my opinion is a great improvement. I hope that in other cases, the use of accurate jacobian will have a positive effect in the convergence. The only thing that I would like to bring is that in the future, you open a PR from su2 repo instead from your personal account. It is easier for the reviewers to compile and test. I will wait Travis pass to merge this PR. Thanks again. Eduardo |
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.
LGTM!
Eduardo
Thank you @EduardoMolina. |
Hi @pcarruscag, All, It's good to see one of this important PR coming to completion. It was a fruitful interaction, and I got to know more stuff. Thanks and Regards |
Hi @pcarruscag and @aeroamit , Thanks for the discussion and for share the ideas/results. I think this is the beauty of open-source, everyone is welcome to jump in and review all the pull requests. Certainly, as you said @aeroamit, we will all learn something fruitful when we review and merge each PR. Best regards, Eduardo |
Proposed Changes
Hi Folks,
I would like your views on something. Many of the convective schemes we have are small variations of each other, and so I was thinking we can maybe have some intermediate numerics classes to make things a bit easier to maintain, quicker to compile etc.
So far I experimented with having a base class for central schemes, the ComputeResidual method is moved to this class and the children classes (Lax, JST, and JST_KE) only implement the artificial dissipation part specific to them.
Similarly AUSM+up(1/2) and SLAU(1/2) only differ in how the mass and pressure fluxes are computed so again a common base for these 4 could be devised. Isolating the computation of mass and pressure fluxes could be an interesting way to compute the Jacobians of these schemes in a hybrid way (currently the Roe Jacobian is used).
There is a very small performance penalty (maybe 1-2% for explicit solution methods) but my reason to be looking at the numerics in the first place is that with some small tweaks to the Jacobians we can probably run most schemes at higher CFL (namely increase the dissipative part of the Jacobian to make the system matrix more diagonal dominant) so for implicit solution methods there would be a speedup.
So, what do you think?
Cheers,
Pedro
PR Checklist