Repository navigation
Conversation
With implicit periodicity, the PERIODIC_RESIDUAL comms delete the rows of the passive points (first marker of each pair) and add only their diagonal block to the master. The off-diagonal blocks of the passive rows, and the columns of other rows that refer to passive points, are lost. On a wedge one cell thick every point is periodic, so most of the Jacobian coupling disappears and the Newton step is useless above CFL ~25. CSolver::CouplePeriodicJacobian moves those blocks to the master rows and columns, rotated, before the comms. Only masters on the same rank and blocks that exist in the sparsity pattern are coupled. Blocks go through GetBlockView/SetBlock, so the quantized Q_LU_SGS storage works too. The edge between a point and its own periodic image is left out of the local time step. It only rotates the state, but it added the sound speed and the viscous term and made the time step ~60x too small on the axis of a wedge. New case TestCases/incomp_rans/morse_swirl_jet (Morse 1980 swirling jet, 5 deg one-cell wedge, SA) and regression test inc_turb_morse_swirl_jet (restart, 10 iterations); mesh and solution are in the TestCases branch fix_periodic_jacobian, which regression.yml points to until it is merged. Regression values of the periodic cases in parallel_regression.py and serial_regression.py are updated; hybrid and AD values are not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5d379c4 to
d88647f
Compare
|
Convergence of the Morse swirling jet (5° one-cell wedge, SA, 4 ranks, from uniform flow, identical config), develop vs this PR. Both builds include #3014 so SA has its free-shear form. This PR reaches rms[P] = -10 in 406 iterations; develop is at -6.8 after the same number of iterations and does not converge. |
- Accumulating SetBlock is a no-op on quantized (Q_LU_SGS) off-diagonal blocks, so the moved blocks were dropped. Quantized blocks are now decoded, added and re-encoded; full-precision blocks keep the in-place addition, so results are unchanged bit for bit. - A passive point is coupled only if every moved block exists in the sparsity pattern of its master. On thicker periodic meshes only the along-face blocks fit; moving those alone slowed the discrete adjoint (transonic_stator AD from -7.31 to -6.76 at iteration 79). Now these meshes behave as on develop, and one-cell wedges and slices keep the full coupling. - Loops run over a list of the coupled passive points instead of all points. - CompletePeriodicComms comments named the wrong marker as master. - Regression values: periodic tests without coupled points are back to their develop values; Morse (after #3014) and the two pipeSlice tests use the values computed by CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No periodic point is coupled in this case. The values change at the 1e-5 level on CI only; local builds of develop and of this branch give bit-identical results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joshkellyjak
left a comment
There was a problem hiding this comment.
Can you add a discrete adjoint test with coupled points? The coupling should not affect the adjoint solver as the linear solve is treated as an external function, so as long as the blocks remain in the same sparsity pattern the transpose is valid, but it's worth adding something to ensure this is the case. A small gradient validation and comparison between direct and adjoint convergence is sufficient.
|
|
||
| SetPeriodicMaster(geometry, config); | ||
|
|
||
| BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS { |
There was a problem hiding this comment.
You could also calculate in preprocessing and store which block moves where, similar to SetPeriodicMaster, which should improve performance even further as at each iteration you can remove the GetBlockView searches. Although I guess the speed up would be minor as I assume these meshes will always be quite small. You could also parallelise this but there probably isn't much of a benefit to it.
- One helper, RotateMomentumBlock, computes Ql*B*Qr^T on the momentum rows and columns. It replaces the hand-unrolled 2D/3D rotation in the periodic comms and the Rotation/RotateRows/RotateColumns lambdas. - Rotation matrices are built once per marker instead of once per block. - CBlockView::apply<false> decodes, adds and re-encodes quantized blocks instead of silently doing nothing, so AddBlock works with Q_LU_SGS and the local workaround is removed. - The time step skips an edge when j is the periodic donor of i on this rank, read from the geometry, independent of whether the point is coupled. This removes skipImages, ArePeriodicImages and the per-iteration call to SetPeriodicMaster. - SetPeriodicMaster is called once from CouplePeriodicJacobian; the redundant implicit_periodic test and the PeriodicPassive member are gone. Regression values are unchanged: for the periodic and Q_LU_SGS cases the results are identical to the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The moved Jacobian blocks and the rotation matrices of the coupling are passive types; RotateMomentumBlock is templated on the block scalar so the comms keep their active block. - Descriptive loop variables (iVar, jVar, iDim, jDim) in RotateMomentumBlock and ReadBlock. - SetPeriodicMaster and CouplePeriodicJacobian use the member nPoint instead of a local nPointAll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@NAnand-TUD @joshkellyjak I've rewritten some parts and it is now almost twice as small. It still needs an adjoint test. |
SetPeriodicMaster runs on the first call of CouplePeriodicJacobian, when the sparsity pattern of the Jacobian is fixed, and also stores the list of coupled points and the rotation matrix of each periodic marker. Cases with no coupled points return before the OpenMP safe-access region. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The periodic part of each dual volume was communicated once, in CommunicateInitialState, so in the discrete adjoint it did not depend on the mesh coordinates and the geometric sensitivities missed its derivative. CSolver::CommunicatePeriodicVolume resets and accumulates the periodic volume; the adjoint fluid iteration calls it after UpdateGeometry. On the Morse swirling jet (one-cell wedge, every point periodic) the adjoint derivative of the inlet static pressure with respect to a smooth mesh deformation changes from +22.6 to -2.02; central finite differences give -2.137. The primal is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…periodic_jacobian

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::CouplePeriodicJacobianmoves the off-diagonal blocks of passive rows and columns to their masters (rotated) before the periodic comms.SetBlockis a no-op there).CompletePeriodicCommscorrected: the second marker of each pair is the master.TestCases/incomp_rans/morse_swirl_jet(Morse 1980 swirling jet, 5 deg one-cell wedge, SA) and regression testinc_turb_morse_swirl_jet, which restarts from a converged solution for 10 iterations.Regression values
inc_turb_morse_swirl_jet(new),sp_pipeSlice_3d_dp_hf_tpandsp_pipeSlice_3d_dp_ihf_tp(one-cell periodic slices, coupled).transonic_stator(serial and parallel discrete adjoint) changed 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.Related Work
MARKER_PERIODICand the implicit treatment: Document MARKER_PERIODIC and its implicit treatment su2code.github.io#234.PR Checklist
pre-commit run --allto format old commits.🤖 Generated with Claude Code