Skip to content

Conversation

@maxaehle
Copy link
Contributor

@maxaehle maxaehle commented Nov 11, 2021

Proposed Changes

Enable time integration by the explicit Euler scheme for e.g. turbulence solvers, by implementing CScalarSolver<>::ExplicitEuler_Iteration.

Related Work

This fixes #1432 with respect to explicit Euler. I need the feature for further investigation of #1414. CScalarSolver was introduced in #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.

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags, or simply --warnlevel=2 when using meson).
  • My contribution is commented and consistent with SU2 style.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp) , if necessary.

PrepareExplicitIteration.
It's a mixture of the implicit Euler in CScalarSolver and the
explicit Euler in CHeatSolver.
@maxaehle
Copy link
Contributor Author

The added lines are a combination of the explicit Euler in CHeatSolver and the implicit Euler in CScalarSolver. Do you consider this approach to be correct?

For the testcase SU2/TestCases/rans/naca0012/turb_NACA0012_sst.cfg, explicit Euler for both flow and turbulence equations and CFL=0.1 converges from the restart solution.

Some more details:

  • CHeatSolver does something with CVariable::Res_TruncError, which is related to multigrid. Maybe additional adaptations are necessary here.
  • PrepareExplicitIteration was copied from PrepareImplicitIteration, except for the computation of the matrix of the linear system. We can remove duplicate code here.
  • CompleteImplicitIteration could be renamed as "add LinSysSol to solution"
    .

Copy link
Member

@pcarruscag pcarruscag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the hard route to fix this 👍
I think RK4 is going to be harder to implement as it would involve changes to CSingleGridIntegration::SingleGrid_Iteration if you don't go for it please add an error somewhere in config postprocessing.

}
END_SU2_OMP_FOR

CompleteImplicitIteration(geometry, solver_container, config);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense given the logic needed to handle SA v SST idiosyncrasies 👍

maxaehle and others added 6 commits November 12, 2021 07:34
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
PrepareExplicitIteration was mainly about computation of residual
norms. We moved this code into two functions called from
ExplicitEuler_Iteration, and also called from
ImplicitEuler_Iteration now (removing duplicate code).
and use it from other locations in the code as well.
Sometimes the residual norm is computed from residuals other
than LinSysRes.
adapted from turb_NACA0012_sst_fixedvalues.cfg
I will fill in the residuals of the CI pipeline in the next commit.
Note that these tests only check that the behavior of the explicit
Euler scheme is constant, but not that it is correct (i.e., it is
the explicit Euler scheme) at the time of this commit.
@pcarruscag pcarruscag linked an issue Nov 12, 2021 that may be closed by this pull request
With this cfg, serial SU2 converges to rms[Rho]<-12 in iteration
2053191,
@maxaehle maxaehle changed the title [WIP] Explicit Euler in CScalarSolver Explicit Euler in CScalarSolver Nov 12, 2021
Copy link
Member

@pcarruscag pcarruscag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍 Good idea with the additional residual reduction cleanup.

Copy link
Contributor

@TobiKattmann TobiKattmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Max for this 💐 looks really neat and kudos for the additional generalizations.
My comments are mostly/only nitpicking stylistic things so nothing major. Only for the curly brace init I would like to get an opinion of pedro

Once develop is merged (and you fix the CodeFactor warning 😄 ) I guess this is good to go then

Co-authored-by: TobiKattmann <31306376+TobiKattmann@users.noreply.github.com>
see C.128 in the C++ Core Guidelines
suggested by CodeFactor
@TobiKattmann
Copy link
Contributor

@maxaehle Can you please also check whether there are problems with periodic BC's? What makes me believe that is CTurbSASolver+167 (and similar for SST)

  /*--- The turbulence models are always solved implicitly, so set the
   implicit flag in case we have periodic BCs. ---*/

  SetImplicitPeriodic(true);

@pcarruscag
Copy link
Member

@TobiKattmann was right about the periodic comms.

Comment on lines +36 to +40
CTurbSolver::CTurbSolver(CGeometry* geometry, CConfig *config, bool conservative)
: CScalarSolver<CTurbVariable>(geometry, config, conservative) {
/*--- Store if an implicit scheme is used, for use during periodic boundary conditions. ---*/
SetImplicitPeriodic(config->GetKind_TimeIntScheme_Turb() == EULER_IMPLICIT);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for checking, then I'll do the same for the SpeciesSolver

TobiKattmann added a commit that referenced this pull request Nov 22, 2021
Which introduces explicit euler for the scalar solvers. Additional
smaller ctor cleanups.
@TobiKattmann
Copy link
Contributor

@maxaehle as far as I see there are no further comments from pedro or me, so if you merge develop + pass the reg test feel free to merge this. (of course if you also have no further plans with this PR)
Thanks again for this contribution!

@maxaehle maxaehle merged commit e3fa7d9 into develop Nov 23, 2021
@maxaehle maxaehle deleted the feature_expliciteuler_scalarsolver branch November 23, 2021 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicit Euler for Turbulence Solver

4 participants