Skip to content

Document MARKER_PERIODIC and its implicit treatment - #234

Open
bigfooted wants to merge 1 commit into
developfrom
periodic_implicit_docs
Open

bigfooted wants to merge 1 commit into
developfrom
periodic_implicit_docs

Conversation

@bigfooted

Copy link
Copy Markdown
Contributor

Adds the MARKER_PERIODIC syntax to the periodic boundary section of Markers and Boundary Conditions, with a 5 degree wedge example, and a paragraph on implicit time integration:

  • the second marker of each pair is the master, the first is passive and receives the master's solution;
  • diagonal blocks are always combined;
  • off-diagonal blocks of a passive point are moved (rotated) to its master only if the master is on the same rank, the point lies on one periodic marker, and all blocks fit the sparsity pattern, i.e. one-cell-thick meshes such as wedges;
  • on those meshes the edge between a point and its periodic image is left out of the local time step.

Companion to su2code/SU2#3016.

🤖 Generated with Claude Code

Describe the MARKER_PERIODIC syntax with a wedge example, and how the
implicit solver couples passive periodic points to their masters
(su2code/SU2#3016).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bigfooted added a commit to su2code/SU2 that referenced this pull request Nov 29, 2026
#3016)

## Proposed Changes
With implicit periodicity, the passive rows (first marker of each pair)
are deleted and only their diagonal block is added to the master, so all
off-diagonal couplings of periodic points are lost. On a wedge one cell
thick every point is periodic and the Newton step becomes useless above
CFL ~25.

- `CSolver::CouplePeriodicJacobian` moves the off-diagonal blocks of
passive rows and columns to their masters (rotated) before the periodic
comms. The table of coupled points is built once, on the first call; the
moved blocks are passive, except in forward AD where the Jacobian itself
is active.
- Coupling is all-or-nothing per point: a passive point is coupled only
if its master is on the same rank, both lie on a single periodic marker,
and every moved block exists in the sparsity pattern. On meshes that are
one cell thick in the periodic direction (wedges) this holds for almost
all periodic points; on thicker meshes no point qualifies and the
treatment is unchanged from develop. Moving only the blocks that happen
to fit (partial coupling) slowed down the primal and the discrete
adjoint on thick meshes.
- Works with the quantized Q_LU_SGS storage (blocks are decoded, added
and re-encoded, since accumulating `SetBlock` is a no-op there).
- With implicit periodicity, the edge between a point and its own
periodic image on the same rank is left out of the local time step (it
made dt ~60x too small on the axis of a wedge).
- The periodic part of the dual volume is communicated again when the
mesh coordinates are recorded (`CSolver::CommunicatePeriodicVolume`), so
the discrete adjoint includes its derivative. Without it the adjoint
gradient on the Morse case had the wrong sign (+22.6 vs -2.14 by finite
differences).
- The passive face of a periodic pair now shows the (rotated) residual
of its master in the volume output; the solution is unchanged.
- Comments in `CompletePeriodicComms` corrected: the second marker of
each pair is the master.
- New case `TestCases/incomp_rans/morse_swirl_jet` (Morse 1980 swirling
jet, 5 deg one-cell wedge, SA), primal regression test
`inc_turb_morse_swirl_jet` (10 iterations from a converged solution) and
discrete-adjoint test `discadj_incomp_turb_morse_swirl_jet` (10 adjoint
iterations, every point periodic, so the coupled Jacobian is in the
adjoint linear solve).

## Results
Morse swirling jet from uniform flow, 4 ranks, develop c7dffa3 vs this
PR, SA and SST (SST with the same inlet velocities, k from the measured
normal stresses and omega = k / nu_t). With the coupling both models
reach rms[P] = -10 in about 400 iterations; develop stalls near -7.

![Morse convergence SA and
SST](https://raw.githubusercontent.com/bigfooted/images/master/morse_pr3016_convergence_sa_sst_2026-11-29.png)

| | iterations | final rms[P] |
|---|---|---|
| SA, develop | 1000 (limit) | -6.90 |
| SA, this PR | 404 | -10.03 |
| SST, develop | 2000 (limit) | -7.15 |
| SST, this PR | 412 | -10.00 |

An iteration of this PR costs more (about 47 linear iterations instead
of 5 on develop), since the linear system now carries the periodic
couplings.

Converged solutions against the measurements of Morse (1980): centreline
velocity, maximum swirl velocity and half-width. Both models
under-predict the extra mixing caused by the swirl up to x/D = 6; SST
also decays too slowly further downstream.

![Morse centreline SA and
SST](https://raw.githubusercontent.com/bigfooted/images/master/morse_pr3016_centreline_sa_sst_2026-11-29.png)

| x/D | 1 | 2 | 4 | 6 | 10 | 15 |
|---|---|---|---|---|---|---|
| U_cl error, SA [%] | -1.9 | +6.8 | +39.5 | +41.2 | +19.3 | +1.3 |
| U_cl error, SST [%] | -1.5 | +6.8 | +40.8 | +51.0 | +39.4 | +30.7 |
| r_1/2 error, SA [%] | -0.5 | -12.9 | -30.9 | -31.1 | -21.7 | |
| r_1/2 error, SST [%] | -0.4 | -11.9 | -30.0 | -33.6 | -30.7 | |

Discrete adjoint on the same case (objective: inlet static pressure,
design variable: amplitude of a smooth axisymmetric mesh deformation):
-2.02 vs -2.14 by central finite differences.

## Regression values
- New: `inc_turb_morse_swirl_jet`,
`discadj_incomp_turb_morse_swirl_jet`.
- Changed, points coupled: `sp_pipeSlice_3d_dp_hf_tp`,
`sp_pipeSlice_3d_dp_ihf_tp` (one-cell periodic slices) and
`periodic3d_axis` (30 deg one-cell wedge, new in develop).
`periodic3d_axis` now converges in 1170 instead of 1900 iterations to
the same solution, so its values at iteration 100 change.
- `transonic_stator` (serial discrete adjoint) changes at the 1e-5 level
on CI only. No point is coupled in this case, and local builds of
develop and of this branch give bit-identical results for it. The
parallel discrete-adjoint values are those of develop.
- All other periodic cases (turbomachinery, CHT, periodic channels, ...)
couple no points and keep their develop values, including hybrid, AD and
aarch64.

## Related Work
- Mesh and converged solution: su2code/TestCases#215 (merged); inlet
profile script: su2code/TestCases#216 (merged).
- #3014 (wall distance without viscous walls) is merged; the Morse
values include it.
- Documentation of `MARKER_PERIODIC` and the implicit treatment:
su2code/su2code.github.io#234.

## 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)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant