Skip to content

Fix L2Roe, LMRoe and the general-gas Roe scheme in 3D - #2944

Merged
rois1995 merged 41 commits into
developfrom
fix_roe_3d_wave_strengths
Nov 17, 2026
Merged

rois1995 merged 41 commits into
developfrom
fix_roe_3d_wave_strengths

Conversation

@rois1995

@rois1995 rois1995 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Proposed Changes

  • 3D flux. Three Roe-type schemes computed part of their numerical dissipation with a 2D formula, also in 3D: L2Roe, LMRoe and the explicit general-gas Roe. So a jump of density or of tangential velocity across a face (a contact or a shear layer) got a wrong flux on faces that are not aligned with the x axis. The standard Roe scheme is already correct (since Consistent calculation of dissipation terms for Roe #299), and 2D is not affected. The three schemes now use the same 3D formula as the standard Roe.

    delta_wave[0] = delta_rho - delta_p/RoeSoundSpeed2;
    delta_wave[1] = (UnitNormal[0]*delta_vel[2]-UnitNormal[2]*delta_vel[0])*zeta;
    delta_wave[2] = (UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1])*zeta;

    delta_wave[0] = delta_rho - delta_p/RoeSoundSpeed2;
    delta_wave[1] = (UnitNormal[0]*delta_vel[2]-UnitNormal[2]*delta_vel[0]);
    delta_wave[2] = (UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1]);

    delta_wave[0] = delta_rho - delta_p/(RoeSoundSpeed*RoeSoundSpeed);
    delta_wave[1] = UnitNormal[0]*delta_vel[2]-UnitNormal[2]*delta_vel[0];
    delta_wave[2] = UnitNormal[1]*delta_vel[0]-UnitNormal[0]*delta_vel[1];

In 3D, the first three columns of the eigenvector matrix used by SU2 ($j = x, y, z$) are

$$P_j = n_j \begin{pmatrix} 1 \\ \mathbf{u} \\ q^2/2 \end{pmatrix} + \rho \begin{pmatrix} 0 \\ \mathbf{n}\times\mathbf{e}_j \\ \mathbf{u}\cdot(\mathbf{n}\times\mathbf{e}_j) \end{pmatrix}$$

so their wave strengths must be

$$\alpha_j = n_j\left(\Delta\rho - \frac{\Delta p}{c^2}\right) + (\Delta\mathbf{u}\times\mathbf{n})_j .$$

With these, $\sum_j \alpha_j P_j$ is exactly the entropy wave plus the shear wave, $\left(\Delta\rho - \Delta p/c^2\right)(1, \mathbf{u}, q^2/2) + \rho,(0, \Delta\mathbf{u}_t, \mathbf{u}\cdot\Delta\mathbf{u}_t)$, where $\Delta\mathbf{u}_t$ is the tangential part of the velocity jump. The three schemes used $\alpha_x = \Delta\rho - \Delta p/c^2$, $\alpha_y = (\Delta\mathbf{u}\times\mathbf{n})_y$, $\alpha_z = (\Delta\mathbf{u}\times\mathbf{n})_z$, which is right only when $\mathbf{n} = \mathbf{e}_x$. This is the standard 3D Roe dissipation (Roe 1981; Blazek 2015). L2Roe and LMRoe keep their low-Mach scaling of the velocity jumps (Oßwald et al. 2016; Rieper 2011).

  • General-gas Roe, protection for non-physical states. When the averaged speed of sound is not valid, the scheme should set the whole Jacobian to zero. Because of a wrong loop index it cleared only the diagonal, and the rest kept the values of the previous face.

    for (iVar = 0; iVar < nVar; iVar++) {
    Flux[iVar] = 0.0;
    for (jVar = 0; jVar < nVar; jVar++) {
    Jacobian_i[iVar][iVar] = 0.0;
    Jacobian_j[iVar][iVar] = 0.0;
    }

A new unit test checks that a contact and a shear layer give the correct (upwind) flux in 2D and 3D for all four Roe variants. Without the fix, 50 of its checks fail.

This PR builds on #2943. It is part of the split of #2941.

References

  • P. L. Roe, Approximate Riemann solvers, parameter vectors, and difference schemes, J. Comput. Phys. 43 (1981) 357–372.
  • J. Blazek, Computational Fluid Dynamics: Principles and Applications, 3rd ed., Butterworth-Heinemann, 2015 (Roe scheme).
  • F. Rieper, A low-Mach number fix for Roe's approximate Riemann solver, J. Comput. Phys. 230 (2011) 5263–5287 (LMRoe).
  • K. Oßwald, A. Siegmund, P. Birken, V. Hannemann, A. Meister, L2Roe: a low dissipation version of Roe's approximate Riemann solver for low Mach numbers, Int. J. Numer. Methods Fluids 81 (2016) 71–86.

Related Work

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • 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.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6

rois1995 and others added 4 commits September 30, 2026 13:46
The factor compares the old and new internal energy, computed as rho*E - 0.5*|rho*u|^2 without the division by
rho (the code comment already refers to the static energy). For dimensional cases this value can be negative,
and those points got a zero update: in the axisymmetric air nozzle 28 % of the points were frozen, and the case
could not re-converge from a restart.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6
… Roe scheme

Only the diagonal was zeroed (index [iVar][iVar] inside the jVar loop), so the off-diagonal entries kept the
values of the previous edge. The guard of CUpwRoeBase_Flow already clears all entries.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6
- Moving grids: the wave speeds, the pressure work of the moving face in the supersonic branches and the term
  V_g (p* - p)/(s - S_M) of the star-state energy were missing or inconsistent, so HLLC was not Galilean
  invariant (NACA0012 M 0.8, fixed grid vs still air and a translating grid: CL -12 %). The flux is now
  computed in the frame of the face (u' = u - w n, H' = H - w u_n + w^2/2) and transformed back
  (F = B F', J = B J' T).
- Jacobians: sign of the velocity term of the general-gas dp/drho. The star-state Jacobians keep by default the
  density of the other state in dp*/dU (inexact, #2198), which was more robust with inexact linear solves in our
  tests; USE_ACCURATE_FLUX_JACOBIANS= YES now gives the exact derivative for fixed wave speeds.
- Unit test hllc_jacobian_tests.cpp: finite differences in 2D and 3D, fixed and moving faces, both sides of
  the contact, all branches, default and exact.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6
… explicit general-gas Roe

In 3D the first three columns of the P matrix combine the entropy wave, weighted by n_j, with the shear waves.
Their strengths are n_j (Delta rho - Delta p / c^2) + (Delta u x n)_j; the entropy jump was used unweighted in the
first one only, so a contact or shear layer on a face not aligned with x got a wrong flux. The standard Roe scheme
already projects the jump with P^-1 since #299. Unit test roe_contact_tests.cpp: a contact and a shear layer give
the upwind flux in 2D and 3D.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6
@joshkellyjak joshkellyjak self-assigned this Oct 12, 2026
@rois1995

Copy link
Copy Markdown
Contributor Author

Merged the updated #2943 in 73af49d to propagate the latest #2942/develop changes through the stack.

Reuse the enthalpy-based flux Jacobian helper in both ideal-gas supersonic branches. Check independently reconstructed face pressure and enthalpy in both Jacobian modes, 2D/3D, and on fixed/moving faces. Remove the general robustness claim from the code comments.
@rois1995

Copy link
Copy Markdown
Contributor Author

Propagated the ideal-gas HLLC supersonic face-enthalpy Jacobian fix and the regression test covering both Jacobian modes from #2943 (4960dd03be). The HLLC unit tests pass with 784 assertions. The convergence comparison and its scope are documented in #2943.

@joshkellyjak
joshkellyjak added this pull request to stack #2987 October 16, 2026 13:43
@bigfooted

Copy link
Copy Markdown
Contributor

@rois1995 can you update all regression tests and also merge the approved PR's, it is getting quite cluttered here in the open PR list.

@rois1995

Copy link
Copy Markdown
Contributor Author

@bigfooted, unfortunately, this builds on PR #2943, and it hasn't been approved yet.

rois1995 and others added 6 commits October 20, 2026 09:39
Keep the develop reference values for the tests that do not use HLLC.
Set the HLLC wedge references to the values from CI run 38910049312.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013YFdgQwrRqCQ2ihG446aNe
@rois1995

Copy link
Copy Markdown
Contributor Author

@bigfooted, once PR #2943 has all regressions passing, we should merge that and right after this one too.

Base automatically changed from fix_hllc_moving_grids to develop November 16, 2026 16:29
@rois1995

Copy link
Copy Markdown
Contributor Author

@bigfooted @joshkellyjak I am merging this and #2945 once the CI is green

@rois1995
rois1995 merged commit 086bfe8 into develop Nov 17, 2026
40 checks passed
@rois1995
rois1995 deleted the fix_roe_3d_wave_strengths branch November 17, 2026 17:46
joshkellyjak added a commit that referenced this pull request Nov 20, 2026
…flow bugs (#2945)

## Proposed Changes

Each fix is in its own commit.

- **Incompressible solver on moving grids.** The Jacobian term of the
grid motion was added once per variable instead of once. The results of
each step do not change, but the inner iterations of unsteady cases
converge much worse. In a pitching airfoil, the lift reached values of
several hundred because the time steps did not converge. The term is now
added once, including the effect of a variable density.


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/numerics/flow/convection/fds.cpp#L252-L265
- **Source terms that cannot be combined.** Some source terms share one
internal object, so when two are active, one silently replaces the
other. For example, body force + gravity gave twice the body force and
no gravity. The first source slot is one object for all of them:


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/drivers/CDriver.cpp#L1843-L1857

  These combinations now stop with a clear error.
- **Turbomachinery Riemann boundary.** It read the settings of the Giles
boundary instead of its own, so it crashed when no Giles marker was
present.


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/solvers/CEulerSolver.cpp#L5800

  It now reads its own settings.
- **Reconstructed face states (MUSCL).** Pressure and density are now
checked to be positive before the fluid model uses them. Before, the
fluid model was called first:


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/solvers/CEulerSolver.cpp#L1952-L1968
- **Incompressible minimum pressure.** With MPI it took the largest of
the local minima.


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/solvers/CIncEulerSolver.cpp#L2238

  It now takes the smallest.
- **Axisymmetric source.** One Jacobian term was always zero, because
`1/2` is an integer division in C++.


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/src/numerics/flow/flow_sources.cpp#L141
- **Green-Gauss gradient.** A fixed-size array had no size check
(mixtures with many species could overflow it).


https://github.com/su2code/SU2/blob/a6b7496b740ac0e63807ee1b066a4badd902da91/SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp#L72

  It is now as large as the one in the limiters, with an error above it.
- **`MGLEVEL` above 10** could exceed the fixed multigrid arrays.
Configuration preprocessing now rejects these settings with the
supported range. Unit tests preserve levels 0 and 10 and verify the
diagnostic for 11.
- **Compressible moving slip walls.** The density/momentum/energy
projection is now applied consistently to the state, residual, Jacobian
and multigrid paths. A boundary/multigrid frame-covariance regression
covers the correction. The associated convergence checks and separate
outlet work are linked from #2943.

The test cases are in the comments below.

This PR builds on #2944. It is part of the split of #2941.

## Related Work

- #2446 (Turbomachinery Riemann boundary).
- #2941 (split).

## PR Checklist

- [x] I am submitting my contribution to the develop branch.
- [x] My contribution generates no new compiler warnings (try with
--warnlevel=3 when using meson).
- [x] My contribution is commented and consistent with SU2 style
(https://su2code.github.io/docs_v7/Style-Guide/).
- [x] I used the pre-commit hook to prevent dirty commits and used
`pre-commit run --all` to format old commits.
- [x] I have added a test case that demonstrates my contribution, if
necessary.
- [x] I have updated appropriate documentation (Tutorials, Docs Page,
config_template.cpp), if necessary.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: rois1995 <rauxa1995@gmail.com>
Co-authored-by: Josh Kelly <81244680+joshkellyjak@users.noreply.github.com>
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.

3 participants