su2code / SU2

SU2: An Open-Source Suite for Multiphysics Simulation and Design
https://su2code.github.io
Other
1.34k stars 844 forks source link

Documentation about SU2_DOT/SU2_DOT_AD for shape design #1017

Closed RoccoBombardieri closed 4 years ago

RoccoBombardieri commented 4 years ago

Hello SU2 community,

I'm currently interested in the theoretical background used in SU2_DOT (both in the FD or AD option). Is it available somewhere? The use I'm interested in is the propagation of the sensitivity of the selected objective function with respect to the boundary grid displacements to the FFD control point displacements.

Moreover I have two specific questions:

1) If, for design optimisation, design variables are the FFD control points, once performed the point inversion (which is usually done only at the beginning of the optimization process), the relation between surface grid nodes and FFD control points is fixed and analytically given by the Bernstein polynomials, once provided the parametric coordinates. Why, then, the need to perform the chain rule with Finite Differences or AD?

2) SU2_DOT uses, to perform the chain rule, surface adjoint solution(in case of FD) or the volume adjoint solution (in case of AD). These values are provided in output by the SU2_CFD adjoint solver. If printing the solution in CSV format I can read, among others, values such "Sensitivity_x","Sensitivity_y","Sensitivity_z","Surface_Sensitivity" on every grid point. Now, these values, trying to give a look inside the code, are addressed as, respectively, sensitivities in x/y/z/normal directions. Are these values the sensitivity of the selected objective function with respect to the grid node displacement?

3) In file python_wrapper_structure.cpp function vector<passivedouble> CDriver::GetMeshDisp_Sensitivity(unsigned short iMarker, unsigned long iVertex) also provides boundary displacement sensitivities of the objective function, with the call: Disp_Sens[0] = solver->GetNodes()->GetBoundDisp_Sens(iPoint, 0);. These values are, in effect the sensitivity of the objective function with respect to the grid node displacements as some Finite Difference tests confirmed. Anyway such values are different by the values mentioned above in question 2. Is that correct? Am I misunderstanding the meaning of the CSV adjoint output?

Thanks in advance for the interest!

pcarruscag commented 4 years ago

For SU2_DOT_AD the mesh deformation is differentiated manually, this is easy to do because it is a linear operation and the stiffness matrix does not depend on the design variables. You can read more about this kind of manual differentiation (forward and reverse) here: https://people.maths.ox.ac.uk/gilesm/files/NA-08-01.pdf

  1. If there is a better way please get involved in the optimization overall discussion.

  2. Your interpretation of the sensitivities is correct. For clarity the FD mode of SU2_DOT is for use with the continuous adjoint only, for which the sensitivities at the surface already include the projection.

  3. Not entirely sure if I understood. I think the interpretation of the boundary displacement sensitivities depends on how you initialize the adjoints. Formally what you should get is the product of the Jacobian transpose with the vector of adjoints you initialize. Those surface sensitivities are different from the ones in the file because they include the volume projection, whereas the ones in the file do not (they are the sensitivity wrt the surface nodes, but not considering that moving surface nodes also moves interior nodes).

RoccoBombardieri commented 4 years ago

Hello Pedro, thanks for your quick reply! More than the differentiation of the mesh deformation problem I was referring to what SU2_DOT does in the specific, at least in terms of workflow. In fact, reading your answer I realise that maybe I'm misunderstanding the process done by SU2_DOT. I thought that, in case of Disc. Adjoint, SU2 solver was already providing the total sensitivity of the objective function with respect to the boundary grid nodes displacements. This already includes the contribution of the mesh deformation. given this, I thought that SU2_DOT was simply projecting such sensitivities on the FFD box point displacements chosen as design variables. But I cannot understand then why the need to include the mesh deformation problem within SU2_DOT. Can you let me know about that please?

pcarruscag commented 4 years ago

The discrete adjoint solvers (all of them, with deforming or static grids) compute sensitivities with respect to displacing individual nodes, the only projection done on the surface sensitivities is onto the surface normal (my previous reply was incomplete). But this is just for post processing, this manipulation still does not consider that moving a surface node (e.g. through an FFD variable) also moves internal nodes, due to the design mesh deformation (as opposed to FSI deformation for example). The volume sensitivity projection of SU2_DOT_AD is the differentiation of SU2_DEF.

For deforming grid cases this step is still required, the best way I can put it in words is that the results still depend on the initial / reference coordinates of the grid, if you move any point of the initial grid you change the results, as you change not only the deformed final position of the point, but also the way the mesh itself responds to the physical (e.g. FSI) surface displacements that it is subject to.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions.