Skip to content

Fix streamwise periodic heat, massflow and auxiliary gradients - #2965

Draft
rois1995 wants to merge 11 commits into
su2code:developfrom
rois1995:fix_streamwise_periodic
Draft

rois1995 wants to merge 11 commits into
su2code:developfrom
rois1995:fix_streamwise_periodic

Conversation

@rois1995

@rois1995 rois1995 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Proposed Changes

Streamwise periodic heat and massflow handling, recovered fields and shared auxiliary gradients contain several consistency errors. This PR corrects these paths and rejects unsupported streamwise configurations.

The corrections cover multigrid rejection, integrated wall heat, the turbulent temperature-source length scale, recovered pressure/temperature along oblique translations, initialized heat output and the threaded prescribed-massflow update. Shared auxiliary Green–Gauss and weighted least-squares helpers now exchange periodic contributions and rotate spatial gradient components. Flamelet preferential-diffusion variables report the four auxiliary fields they allocate.

The recovered-temperature correction at a heated wall now uses the inward-normal sign. Configuration checks require a nonzero purely translational first pair and reject temperature recovery with unsupported convective/CHT walls. Valid configuration controls demonstrate develop accepting these combinations and the branch giving the intended error.

Pipe/massflow regressions and BOX units cover uniform/stretched translation and helical meshes, GG/WLS, flamelet metadata/gradients and a curved heated wall. No auxiliary unweighted-LS implementation is added: that source/viscous option is already rejected by develop. Full chemistry-table flamelet and end-to-end adjoint checks remain pending.

Validation of the combined periodic source passes serial, partitioned MPI2, OpenMP2 and MPI2×OpenMP2 (10 cases / 3175 serial assertions). Individual branch CI and complete regression/reference checks are pending. Test configurations, meshes, logs and before/after values are in the testcase comment. New regression references are local x86 values and need CI confirmation.

Related Work

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (complete branch CI pending).
  • My contribution is commented and consistent with SU2 style.
  • I ran the repository pre-commit checks on the changed files.
  • I have added tests that demonstrate the contribution.
  • I have updated appropriate documentation, if necessary.

rois1995 and others added 8 commits October 6, 2026 08:28
The run crashed before the first iteration, the streamwise periodic
quantities are only set up on the fine grid.

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

With INTEGRATED_HEATFLUX= YES the value of MARKER_HEATFLUX is in W, it was
multiplied by the area again as if it was in W/m2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UkNcoCEH8nFNrHWzhJCar
The term with the gradient of the eddy viscosity was divided by the length
of the translation vector instead of its square.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UkNcoCEH8nFNrHWzhJCar
…nd temperature

The sum of the absolute values of each component is only the distance
along the translation vector if the vector is aligned with an axis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013UkNcoCEH8nFNrHWzhJCar
The heat was printed with whatever was in memory when the energy equation
was off.

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

rois1995 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Test cases

Files (configurations, histories, meshes): periodicBoundaries/streamwise. 2 MPI ranks, "develop" = 6db10127d1. The values of the new test are from my machine and will be updated from the CI.

1. Multigrid: sp_pipeSlice_3d_dp_hf_tp.cfg with MGLEVEL= 1: segmentation fault on develop, "Streamwise Periodicity does not support multigrid, use MGLEVEL= 0." with this PR.

2. INTEGRATED_HEATFLUX: the pipe slice with the energy equation and STREAMWISE_PERIODIC_TEMPERATURE= YES. The wall area is 1.570028e-5 m2, so 1000 W/m2 and 0.01570028 W with INTEGRATED_HEATFLUX= YES are the same case.

SWHeat [W] rms[h] after 3 iterations
1000 W/m2 -0.01570028 -5.079704
0.01570028 W integrated, develop -2.464989e-07 -5.105232
0.01570028 W integrated, this PR -0.01570028 -5.079704

New test sp_pipeSlice_3d_dp_ihf_tp (10 iterations): STREAMWISE_HEAT -0.000000 on develop, -0.015700 with this PR.

3. Turbulent source term: the temperature is T = T~ + Q / (mdot cp L^2) (t . x), so the turbulent conductivity cp mu_t / Pr_t gives the source Q / (mdot L^2 Pr_t) (t . grad mu_t). The code had L instead of L^2 (L = 0.0111544 m in the pin array, a factor 90). One iteration from the turbulent solution of chtPinArray_2d with STREAMWISE_PERIODIC_TEMPERATURE= YES: rms[h] 0.7429064562 on develop, 0.7429043857 with this PR. No regression test: the change is in the sixth digit.

4. Recovered pressure: the pin array on the mesh rotated by 30 degrees. The difference between recovered and periodic pressure must be the same at the same points as on the original mesh: it differs by up to 0.53 Pa (pressure drop 5.58 Pa) on develop, 3e-15 Pa with this PR. No regression test: the recovered values are only in the volume output.

5. SWHeat output: with the energy equation off, sp_pipeSlice_3d_dp_hf_tp writes 0.0005 in the SWHeat column of the history on develop, 0 with this PR. The value on develop depends on the run.

6. Prescribed massflow with OpenMP: a generated 9x9x9 BOX channel, five iterations. The unguarded upstream update produces thread-dependent pressure histories. With this PR, one/two-thread pressure drops agree within 1e-8 and the repeated two-thread history is identical; two MPI ranks also agree. The one-thread history is unchanged. New hybrid regression sp_massflow_box checks iteration 4: rms[P] -4.914357, pressure drop 0.248162, massflow -0.092770.

7. Auxiliary Green–Gauss gradient: the actual solver helper, scalar 2+3y-z on a translational periodic BOX: maximum gradient error 20 before the fix. Translation and a 90-degree helical rotation now pass, also on two MPI ranks. Auxiliary fields are scalars, so only spatial gradient components rotate. The test is in UnitTests/SU2_CFD/gradients.cpp.

Existing tests

No reference value changes. Unchanged history files, develop against this PR: sp_pinArray_cht_2d_dp_hf, sp_pinArray_3d_cht_mf_hf_tp, inc_heatTransfer_BC, and sp_pipeSlice_3d_dp_hf_tp except its SWHeat column.

Follow-up validation (Oct 7)

The combined periodic source passes the release OpenMP/MPI build and the targeted gradient/thread checks. A separate D build also passes. The broader OpenMP unit runner aborts on the baseline too, so no whole-suite pass is claimed. Both actual upstream solver implementations reproduce the failures in the D harness; D sources were restored and all targeted checks pass. Forward/reverse OpenMP AD interface syntax checks pass. A full AD link and sensitivity validation were not performed.

Additional tests (Oct 7)

Reproducers, configurations, numeric logs and scripts: auxiliary. Develop = 6db10127d1; BOX fixtures generate their meshes. The original B–D evidence above was recorded before the expanded follow-ups.

Check develop fixed combined source
Auxiliary GG/WLS, uniform/stretched translation and helical rotation 8/16 assertions fail; GG errors 8.875–20.4922, WLS 0.75 passes
Flamelet preferential-diffusion metadata and helper 8/8 fail; count 0 vs allocated 4, gradient error 12 count 4; GG/WLS pass
Curved heated-wall correction residual error 3.806e-6 analytic residual passes
First-pair rotation/zero shift; convection/CHT walls with recovered temperature valid inputs accepted exact support diagnostics

The flamelet check exercises the real variable metadata and shared gradient helper with controlled scalar fields; it is not a full chemistry-table flow. Restart pressure/discard semantics were tested and work on develop, so no patch was made. Auxiliary unweighted LS is already unsupported for source/viscous terms.

Combined release checks: serial and OpenMP2 pass 10 cases / 3175 assertions; partitioned MPI2 and MPI2×OpenMP2 pass on both ranks (2334 / 2238 assertions). These are combined-source checks, not standalone builds of every branch. Complete branch CI and full regression/reference checks remain pending.

Comment thread SU2_CFD/src/solvers/CSolver.cpp Fixed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants