su2code/SU2

awkward results with DISCRETE_ADJOINT in the Quick Start tutorial

frx-wintermute opened this issue · 1 comments

Hi!

I tried the Quick Start tutorial.

I built SU2 from source (from commit 3f68501 , branch 'develop').
I took files 'mesh_NACA0012_inv.su2' and 'inv_NACA0012.cfg' from the same commit.

I managed to obtain a correct solution for the DIRECT problem (pressure field visualized with ParaView from 'flow.vtu' looks reasonably similar to the image shown in the tutorial).
Afterward, I changed the parameter MATH_PROBLEM from DIRECT to CONTINUOUS_ADJOINT in the configuration file and:

$ ln -s restart_flow.dat solution_flow.dat
$ SU2_CFD inv_adj_NACA0012.cfg

I obtained a correct adjoint solution (density adjoint field visualized with ParaView from 'adjoint.vtu' looks reasonably similar to the image shown in the tutorial).

Finally, I wanted to also try the algorithmic differentiation, so I changed the parameter MATH_PROBLEM to DISCRETE_ADJOINT in the configuration file and:

$ SU2_CFD_AD inv_dadj_NACA0012.cfg

I failed to obtain a correct adjoint solution (I expected to see something really similar to what I got with the CONTINUOUS_ADJOINT method): the density adjoint field seems to have a completely different scale (instead of having values in the approximate range -200 ÷ +200, it has values in the range -0.264 ÷ +0.217 and the values not too close to zero are concentrated in an area near the farfield boundary, far from the airfoil).

What's wrong?
Does anything else need to be changed in the configuration file?

Bug report checklist

From the above mentioned commit, I built with:

$ ./preconfigure.py --no-medi --no-opdi --no-mpp --no-coolprop
$ export CXXFLAGS='-march=native -mtune=native -O3 -msse -mfpmath=sse'
$ meson setup -Dwith-mpi=disabled -Denable-cgns=true -Denable-tecio=false -Denable-autodiff=true -Denable-directdiff=true --prefix=${HOME}/local build
$ ninja -C build install

N.B.: CPU is an Intel Core i5-6600 CPU @ 3.30GHz

I haven't found any other GitHub issue about the Quick Start tutorial.

I used the tip of the develop branch, as of yesterday.

Desktop:

  • OS: Debian GNU/Linux 12.0 'bookworm' (up-to-date Debian testing)
  • C++ compiler and version: g++ (Debian 12.2.0-14) 12.2.0
  • MPI implementation and version: irrelevant (built without MPI support)
  • SU2 Version: commit 3f68501 , branch 'develop'

The adjoint values from continuous and discrete approaches are not comparable