Open
Conversation
A-CGray
requested changes
Mar 5, 2026
Member
A-CGray
left a comment
There was a problem hiding this comment.
Thanks for these fixes @SichengHe , can you please update your tests to use ADflow's existing RegTest class. See this file for an example.
Also, which version of Tapenade did you use to generate the new derivative code? I think the failing Tapenade check is probably due to a version mismatch, the test uses 3.16
tests/test_ts_adjoint.py
Outdated
Member
There was a problem hiding this comment.
Please put this file in the reg_tests directory
tests/test_ts_adjoint.py
Outdated
Comment on lines
+16
to
+17
| # Add the test directory to path for reg_default_options | ||
| sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "reg_tests")) |
Member
There was a problem hiding this comment.
Shouldn't need this once file is moved
Collaborator
Author
There was a problem hiding this comment.
should be all good now.
Thanks for all the feedback! They are very helpful.
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.
Purpose
Fix the time spectral (TS) adjoint, which was completely broken because the
case (timeSpectral)block ininitres_block(src/solver/residuals.F90) was wrapped inside#ifndef USE_TAPENADE, so Tapenade never generated adjoint code for the spectral time derivative terms. The generated AD code only handledcase (steady), completely missing the TS contributions.Changes:
case (timeSpectral)inresiduals.F90to Tapenade by moving the#endifboundary, with#ifdef USE_TAPENADEblocks to replace pointer access with directflowDomsarray access (required since Tapenade cannot differentiate through Fortran pointers)residuals_b.f90residuals_d.f90residuals_fast_b.f90tests/test_ts_adjoint.pyfor verificationExpected time until merged
Non-urgent. A week or two is fine.
Type of change
Testing
Run with 2 MPI ranks on the NACA 64A010 Euler time spectral case (3 time intervals, pitching oscillation):
mpirun -np 2 python tests/test_ts_adjoint.py
Three tests are performed:
evalFunctionsSens): all three adjoint solves (cd, cl, cmz) convergeChecklist
ruff checkandruff formatto make sure the Python code adheres to PEP-8 and is consistently formattedfprettifyor C/C++ code withclang-formatas applicable