Repository navigation
Conversation
Contributor
Author
|
Main thing to go through is the adaptive CFL. It needs more attention anyway, because it is the best convergence accelerator that we have. For now this seems to work well on the cases I've tested. |
| su2double wallNormal[MAXNDIM] = {0.0}; | ||
| unitNormal(iWall, wallVertex, wallNormal); | ||
|
|
||
| for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { |
| cout << "First-order reconstruction at " << nFlaggedGlobal << " points where a no-slip wall ends or has a sharp edge." << endl; | ||
|
|
||
| /*--- A halo may lack one of the markers its owner has, so it takes the owner's flag. ---*/ | ||
| for (unsigned short iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) { |
Agglomeration: - In 3D a symmetry plane met at an angle by another boundary no longer makes a node mixed, so wall/symmetry edges coarsen instead of staying fine-size singletons on every level (3D bump: 288 -> 26 singletons per level). - Columns standing on mixed nodes (wall ends) are paved first, so no column from either side straddles a leading or trailing edge. - A column only advances along a stiff edge of the mesh, so columns from side planes no longer march along thin layers and break up wall-normal columns. Prolongation: - The linear prolongation gradient is rejected only for a degenerate stencil (condition of the unit directions), and solved by Cholesky, instead of rejecting every stretched cell (constant fallback 31% -> 1.5% of cells). - Each level's correction fades in over 4 coarse CVs from where a wall ends. Adaptive CFL: escalating cuts on repeated stalls, and cap increases stay below the cap set at the last stall. 3D bump 17x177x81 (MG_CFL_SCALING 0.05): MG1 313 its, MG2 374, single grid 561, MG1 before 1128. 2D flat plate and 3-element airfoil unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On an agglomerated coarse level the averaged gradient term of the viscous flux crosses faces that are poorly aligned with the edges between CV centroids. The implicit Jacobian does not hold that term, so the coarse iteration diverged once the coarse CFL exceeded a few hundred, which is why MG_CFL_SCALING had to be around 0.05. With the primitive gradients zero on coarse levels the coarse residual matches its Jacobian and the coarse smoother converges at any CFL. 3D bump 9x89x41, MG_CFL_SCALING 0.25: MG1 204, MG2 200, MG3 202 iterations (single grid 210, previously 700 / 318 / 321 or worse). Scaling 1.0 also works. 2D flat plate and 3-element airfoil unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A flip-flop above a certain CFL repeats at every CFL that the cap probe and the ceiling regrowth reach again, so on a stalled run each attempt cost 40 to 70 iterations and the residual never fell. The lowest CFL at which a flip-flop occurred now caps the CFL at half of it and limits the cap probe to that, until the flow residuals have fallen three orders of magnitude. 3D bump 17x177x81, MG1, CFL cap 1e5: converges in 480 iterations where it stalled at -10 for more than 960. Single grid, 2D flat plate, 2_2DCJ and the 2D bump are unchanged (561, 226, 330, 581 iterations); 4_2DANW does not reach the rule and behaves as before. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rge function' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…e/su2 into feature_mg_linear_prolong
# Conflicts: # Common/src/linear_algebra/CSysSolve.cpp
| struct alignas(64) LevelProgress { | ||
| std::atomic<uint64_t> steps{0}; | ||
| LevelProgress() = default; | ||
| LevelProgress(const LevelProgress& other) : steps(other.steps.load()) {} |
| su2double correction = factor * Residual_Fine[iVar]; | ||
| /*--- Prevent a fine grid divergence due to a coarse grid divergence ---*/ | ||
| for (auto iVar = 0u; iVar < nVar; iVar++) | ||
| if (Residual_Fine[iVar] != Residual_Fine[iVar]) Residual_Fine[iVar] = 0.0; |
4 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Multigrid on stretched meshes was slow or unstable in three situations. The coarse grids differed with the number of MPI ranks. The coarse-grid correction was only piecewise constant. The CFL adaptation could not tell a stuck run from a converging one. This branch addresses these. Every new option is off by default.
Main changes
The reconstruction is exact for a linear correction, and the children still average back to the coarse value.
Walls and symmetry planes keep the constant operator.
Narrow 1×2 patches are handled in the line paving.
The agglomeration of RAE2822-type meshes is improved.
Columns that reach a partition interface are handed to the neighbouring rank. The coarse-grid halo coordinates are taken from the owning rank, so coarse stencils don't depend on the partitioning.
Wall distance and roughness are restricted to the coarse grids and exchanged to halo points. The nearest-neighbour wall distance is recomputed on the coarse levels.
Coarse-level residuals are reduced across ranks. MGLEVEL is checked against the supported maximum.
The startup stagnation test no longer counts a growing residual as stagnation.
Graph edges are weighted by the aspect ratio of their cells, and anisotropic lines are moved onto a single rank.
Line edges are now identified by a rule that is stable under ties: an edge joins a line if it is the strongest at one end, or at least half the strongest at both ends. Before, a single "strongest edge" link per point fragmented lines on near-uniform spacing, and that is what made convergence depend on the rank count.
Growth: the CFL grows while the residuals fall.
Jumps: a median jump across the flow equations, or a failed linear solve, halves the CFL. A spike of more than one decade in any single flow residual within 5 iterations does the same. Repeated events at similar CFL set a lasting cap.
Stagnation: no progress for 150 iterations caps the CFL below its current value.
Frozen residuals [independent of multigrid]: if the mean log flow residual, with turbulence left out, varies by less than 0.01 decades over 30 iterations, the CFL cap becomes 0.6 times the current CFL.
AD build fixes for the discrete-adjoint build.
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.
pre-commit run --allto format old commits.