CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 Shape Design (https://www.cfd-online.com/Forums/su2-shape-design/)
-   -   Drag Coefficient Gradient: 0 in 2d adjoint optimization (https://www.cfd-online.com/Forums/su2-shape-design/185398-drag-coefficient-gradient-0-2d-adjoint-optimization.html)

tomp1993 March 24, 2017 12:11

Drag Coefficient Gradient: 0 in 2d adjoint optimization
 
hi,
I'm running a shape optimization for a 2D drag minimization problem on a simple supersonic aerofoil. The flow and adjoint solutions converge reasonably, but for some reason the gradient at each design variable is zero.
I have the complete FFD definition in both the cfg and SU2 grid files (attached).
anyone have any ideas as to where i might be going wrong? i've tried editing the FFD and DV definitions but nothing seems to help. i'm using V5.0.0 but as far as i can tell the FFD definition is correct for that version.
any ideas really appreciated.
Tom.
CFG file (FFD AND DV DEFINITION STUFF ONLY):
Code:

DV_KIND= FFD_CONTROL_POINT_2D
%
DV_MARKER= ( UPPER, LOWER )
%
DV_PARAM= ( FFD_FOIL, 4, 2, 0.01, 0.01)
%
DV_VALUE= 0.0
%
FFD_TOLERANCE= 1E-6
%
FFD_ITERATIONS= 100
%
FFD_DEFINITION= (FOIL, 0.0, 0.1, 0.0, 1, 0.1, 0.0, 1, -0.1, 0.0, 0, -0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
%
FFD_DEGREE= (4, 2, 0)
%
FFD_CONTINUITY= 1ST_DERIVATIVE
%
OPT_OBJECTIVE= DRAG * 0.001
%
OPT_CONSTRAINT= ( MAX_THICKNESS > 0.06 ) * 0.001; ( LIFT = 0.0772 ) * 0.001
%
OPT_ITERATIONS= 100
%
OPT_ACCURACY= 1E-4
%
OPT_BOUND_UPPER= 0.1
%
OPT_BOUND_LOWER= -0.1
%
DEFINITION_DV= ( 15, 1 | foil | FFD_FOIL, 0, 0, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 1, 0, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 2, 0, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 3, 0, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 4, 0, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 0, 1, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 1, 1, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 2, 1, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 3, 1, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 4, 1, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 0, 2, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 1, 2, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 2, 2, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 3, 2, 0.1, 0.1); ( 15, 1 | foil | FFD_FOIL, 4, 2, 0.1, 0.1)

su2 mesh (definition parts only - whole mesh too big to upload!)
Code:

NDIME= 2
AOA_OFFSET= 0
AOS_OFFSET= 0
NELEM= 17464

# 2D MESH GOES HERE BUT NOT INCLUDED #

NPERIODIC= 1
PERIODIC_INDEX= 0
0.000000000000000e+00    0.000000000000000e+00    0.000000000000000e+00
0.000000000000000e+00    0.000000000000000e+00    0.000000000000000e+00
0.000000000000000e+00    0.000000000000000e+00    0.000000000000000e+00
FFD_NBOX= 1
FFD_NLEVEL= 1
FFD_TAG= FFD_FOIL
FFD_LEVEL= 0
FFD_DEGREE_I= 4
FFD_DEGREE_J= 2
FFD_BLENDING= BEZIER
FFD_PARENTS= 0
FFD_CHILDREN= 0
FFD_CORNER_POINTS= 4
0    0.1
1    0.1
1    -0.1
0    -0.1
FFD_CONTROL_POINTS= 15
0    0    0    0    0.1    0
0    1    0    0    0    0
0    2    0    0    -0.1    0
1    0    0    0.25    0.1    0
1    1    0    0.25    0    0
1    2    0    0.25    -0.1    0
2    0    0    0.5    0.1    0
2    1    0    0.5    0    0
2    2    0    0.5    -0.1    0
3    0    0    0.75    0.1    0
3    1    0    0.75    0    0
3    2    0    0.75    -0.1    0
4    0    0    1    0.1    0
4    1    0    1    0    0
4    2    0    1    -0.1    0
FFD_SURFACE_POINTS= 199
#ONLY TWO POINTS INCLUDED IN THIS POST FOR CONCISENESS#
LOWER    104    9.928418222292663e-05    5.000597183305870e-01    5.000000000000000e-01
UPPER    1    1.000000000000000e+00    5.000000000000000e-01    5.000000000000000e-01


Haowang March 27, 2017 05:47

Hi tom,

I would recommand you to check whether the FFD box intersects with the airfoil surface. Or you could also check the screen output of SU2_DEF and SU2_DOT modules. In some case, it will tell you that some planes has been fixed to ensure the continuity of the surface. If so, the FFD control points won't move and the corresponding gradients will be zero as well.

Hao Wang

tomp1993 March 27, 2017 10:00

Thanks for your help!
so, you are right and it is fixing planes which are intersecting.
is there a way to switch this off without changing the geometry or size of the FFD box? or should i simply re-make the FFD box so that its control points lie entirely outside of the geometry? should it matter if an FFD connector (edge) is penetrating the surface or is it simply a case of relocating the control points?

tomp1993 March 27, 2017 10:57

i have made a new FFD definition with no points within the aerofoil and no connectors (edges) penetrating the surface, but for some reason am still having the same response to SU2_DEF:
Code:

------------------------- Surface grid deformation ----------------------
Performing the deformation of the surface grid.
1 Free Form Deformation boxes.
1 Free Form Deformation nested levels.
FFD box tag: FFD_FOIL. FFD box level: 0. Degrees: 4, 1.
FFD Blending using Bezier Curves.
Number of parent boxes: 0. Number of child boxes: 0.
Corner points: 4. Control points: 10. Surface points: 199.
Writing a Paraview file of the FFD boxes.

----------------- FFD technique (parametric -> cartesian) ---------------
Checking FFD box dimension.
Checking FFD box intersections with the solid surfaces.
SU2 is fixing the planes to maintain a continuous 2nd order derivative.
Update cartesian coord        | FFD box: FFD_FOIL. Max Diff: 0.52505.
Writing a Paraview file of the FFD boxes.

not really sure where to go from here?
also, when i run shape_optimization.py, the log_adjoint file says the FFD box is different (see corner points, surf points...), which it isn't...
Code:

---------- Start gradient evaluation using surface sensitivity ----------
Read the FFD information from mesh file.
1 Free Form Deformation boxes.
1 Free Form Deformation nested levels.
FFD box tag: FFD_FOIL. FFD box level: 0. Degrees: 4, 1.
Number of parent boxes: 0. Number of child boxes: 0.
Corner points: 0. Control points: 4. Surface points: 0.
Check the FFD box intersections with the solid surfaces.
-------------------------------------------------------------------------


Haowang March 27, 2017 23:00

Quote:

Originally Posted by tomp1993 (Post 642487)
i have made a new FFD definition with no points within the aerofoil and no connectors (edges) penetrating the surface, but for some reason am still having the same response to SU2_DEF:
Code:

------------------------- Surface grid deformation ----------------------
Performing the deformation of the surface grid.
1 Free Form Deformation boxes.
1 Free Form Deformation nested levels.
FFD box tag: FFD_FOIL. FFD box level: 0. Degrees: 4, 1.
FFD Blending using Bezier Curves.
Number of parent boxes: 0. Number of child boxes: 0.
Corner points: 4. Control points: 10. Surface points: 199.
Writing a Paraview file of the FFD boxes.

----------------- FFD technique (parametric -> cartesian) ---------------
Checking FFD box dimension.
Checking FFD box intersections with the solid surfaces.
SU2 is fixing the planes to maintain a continuous 2nd order derivative.
Update cartesian coord        | FFD box: FFD_FOIL. Max Diff: 0.52505.
Writing a Paraview file of the FFD boxes.

not really sure where to go from here?
also, when i run shape_optimization.py, the log_adjoint file says the FFD box is different (see corner points, surf points...), which it isn't...
Code:

---------- Start gradient evaluation using surface sensitivity ----------
Read the FFD information from mesh file.
1 Free Form Deformation boxes.
1 Free Form Deformation nested levels.
FFD box tag: FFD_FOIL. FFD box level: 0. Degrees: 4, 1.
Number of parent boxes: 0. Number of child boxes: 0.
Corner points: 0. Control points: 4. Surface points: 0.
Check the FFD box intersections with the solid surfaces.
-------------------------------------------------------------------------


As far as i know, only when your FFD box doesn't intersect with the airfoil surface, theoretically all the control points set as design variables can move.
I think you need to check the ffd_box.dat file to make sure whether the ffd box has been changed or not, because from your screen output, it doesn't say that any plane has been fixed.
As for your log_adjoint file, I didn't encounter this problem before. I guess you didn't use SU2_DEF to set your FFD box.

tomp1993 March 30, 2017 06:31

Hi again,
so i have tried using SU2_DEF to set the FFD box instead of the Pointwise script, and have exactly the same issue. SU2_DEF executed without any problems and i can't see anything obviously wrong with the .su2 file which it outputted.
the adjoint solution is reasonably converged and shows the surface sensitivities as expected.
once again, log_adjoint outputs the following:
Code:

---------- Start gradient evaluation using surface sensitivity ----------
Read the FFD information from mesh file.
1 Free Form Deformation boxes.
1 Free Form Deformation nested levels.
FFD box tag: FFD_FOIL. FFD box level: 0. Degrees: 4, 1.
Number of parent boxes: 0. Number of child boxes: 0.
Corner points: 0. Control points: 4. Surface points: 0.
Check the FFD box intersections with the solid surfaces.
-------------------------------------------------------------------------

Design variable number 0.
Perform 3D deformation of the surface.
Update cartesian coord        | FFD box: FFD_FOIL. Max Diff: 0.
Evaluate functional gradient using the continuous adjoint strategy.
Drag coefficient gradient: 0.

#and so on...#

whereas SU2_DEF outputs this:
Code:

------------------------- Surface grid deformation ----------------------
Performing the deformation of the surface grid.
1 Free Form Deformation boxes.
1 Free Form Deformation nested levels.
FFD box tag: FFD_FOIL. FFD box level: 0. Degrees: 4, 1.
FFD Blending using Bezier Curves.
Number of parent boxes: 0. Number of child boxes: 0.
Corner points: 4. Control points: 10. Surface points: 199.
Writing a Paraview file of the FFD boxes.

----------------- FFD technique (parametric -> cartesian) ---------------
Checking FFD box dimension.
Checking FFD box intersections with the solid surfaces.
SU2 is fixing the planes to maintain a continuous 1st order derivative.
Update cartesian coord        | FFD box: FFD_FOIL. Max Diff: 0.525.
Writing a Paraview file of the FFD boxes.

i am quite confused as they seem to be reading the FFD information differently? SU2_DEF is fine but shape_optimization.py just doesnt seem to be reading the FFD information in the same way?
thanks for the help.

talbring March 31, 2017 04:19

Hi Tom,

it looks like shape_optimization.py uses an older version of SU2_DEF (the line "FFD Blending using Bezier Curves." was added with changes in 5.0. Make sure that the environment variables SU2_RUN and PATH are pointing to the correct directories.

Tim

tomp1993 April 11, 2017 09:25

Thanks Tim that was absolutely bang on,
turns out i had SU2_HOME pointed to 5.0.0 but SU2_RUN pointed to the previous version.
Tom

talbring April 12, 2017 04:07

Glad that it solved the problem. Thanks for letting us know.

tomp1993 August 29, 2017 12:44

Hi,
so; i thought this issue had been resolved by following your advice; and whilst you were correct; unfortunately the issue is not solved.
the gradient i am finding is still zero.
i have also included AOA as a design variable, and the gradient for this is non-zero as expected.
log_adjoint.out shows the following:
Code:

---------- Start gradient evaluation using sensitivity information ----------
Evaluate functional gradient using Finite Differences.

Design variable number 1.
Performing 3D deformation of the surface.
...
Design variable (ANGLE_OF_ATTACK) number 0.
DRAG gradient : 0.00274491
-------------------------------------------------------------------------

Design variable (FFD_CONTROL_POINT_2D) number 1.
DRAG gradient : 0
-------------------------------------------------------------------------
...
etc

whilst log_geometry.out shows:
Code:

-------------------- Objective function evaluation ----------------------

Station 1. Plane (yCoord): 0.
Max. thickness: 0.0599312, 1/3C thickness: 0.0533524, 2/3C thickness: 0.0533529
1/4C thickness: 0.045046, 1/2C thickness: 0.0599898, 3/4C thickness: 0.0450466
Area: 0.0400106, Twist angle: 0, Chord: 0.999996

------------- Gradient evaluation using finite differences --------------
Design Variable not implemented yet

Station 1. Plane (yCoord): 0.
Max. thick. grad.: 0. 1/3c thick. grad.: 0. 2/3c thick. grad.: 0.
1/4c thick. grad.: 0. 1/2c thick. grad.: 0. 3/4c thick. grad.: 0.
Area grad.: 0. Twist angle grad.: 0. Chord grad.: 0.

-------------------------------------------------------------------------

Design variable number 1.
Perform 3D deformation of the surface.

Station 1. Plane (yCoord): 0.
Max. thick. grad.: 0. 1/3c thick. grad.: 0. 2/3c thick. grad.: 0.
1/4c thick. grad.: 0. 1/2c thick. grad.: 0. 3/4c thick. grad.: 0.
Area grad.: 0. Twist angle grad.: 0. Chord grad.: 0.

-------------------------------------------------------------------------

I have initialised the FFD box using SU2_DEF with V.5.0.0.
the description in the .su2 grid is as follows:
Code:

NPERIODIC= 1
PERIODIC_INDEX= 0
0.000000000000000e+00  0.000000000000000e+00  0.000000000000000e+00
0.000000000000000e+00  0.000000000000000e+00  0.000000000000000e+00
0.000000000000000e+00  0.000000000000000e+00  0.000000000000000e+00
FFD_NBOX= 1
FFD_NLEVEL= 1
FFD_TAG= FFD_FOIL
FFD_LEVEL= 0
FFD_DEGREE_I= 4
FFD_DEGREE_J= 1
FFD_BLENDING= BSPLINE_UNIFORM
BSPLINE_ORDER_I= 2
BSPLINE_ORDER_J= 2
FFD_PARENTS= 0
FFD_CHILDREN= 0
FFD_CORNER_POINTS= 4
-0.05  0.06
1.05    0.06
1.05    -0.06
-0.05  -0.06
FFD_CONTROL_POINTS= 10
0      0      -0.05  0.06
0      1      -0.05  -0.06
1      0      0.225  0.06
1      1      0.225  -0.06
2      0      0.5    0.06
2      1      0.5    -0.06
3      0      0.775  0.06
3      1      0.775  -0.06
4      0      1.05    0.06
4      1      1.05    -0.06
FFD_SURFACE_POINTS= 398
...
etc

(i have also tried with all xyz,ijk values of the corner and control points as opposed to just xy and ij as shown above; the result is the same!)
Thanks in advance!
Tom.

aravindh_kulandaivel July 19, 2018 07:30

Quote:

Originally Posted by Haowang (Post 642573)
As far as i know, only when your FFD box doesn't intersect with the airfoil surface, theoretically all the control points set as design variables can move.
I think you need to check the ffd_box.dat file to make sure whether the ffd box has been changed or not, because from your screen output, it doesn't say that any plane has been fixed.
As for your log_adjoint file, I didn't encounter this problem before. I guess you didn't use SU2_DEF to set your FFD box.

Hello,
I have the same problem. My SU2 is fixing the planes, so no deformation occurs when visualized in PARAVIEW. But ffd boxes are changing as per ffd_box.dat file. Could you please help me to solve this issue?

Thanks in advance
Aravindh

angupraveen August 1, 2019 15:14

FFD not interracting with geometry
 
Dear all,

I know this is a long shot, but you are the one who can help me here.

I am trying to optimize the wing section of a BWB aircraft. I am currently facing a problem where my FFD is not interacting with the geometry.

I am not aware of how to get over this. So basically I ran the SU2_DEF and generated the FFD and then set up a few control points(198 in my case) as design variables and then run SU2_CFD and SU2_CFD_AD after that.

Once all the calculations are done, I wanted to do the sensitivity analysis before going forward with the optimization. Unfortunately, my FFD intersects the geometry and all the gradients are "Zero". I tried changing the FFD_CONTINUITY to 'NO_DERIVATIVE', '1ST_DERIVATIVE' and also 2ND_DERIVATIVE. But the results are the same.

It would be really helpful if you can help me bypass this issue,

I've attached a few pictures and the outputs for your reference.

Looking forward to hearing from you.

Kind regards

Angu


----------------- FFD technique (parametric -> cartesian) ---------------
Checking FFD box dimension.
Checking FFD box intersections with the solid surfaces.
The FFD planes i=0, i=10, intersect solid surfaces.
SU2 is fixing the planes to maintain a continuous 2nd order derivative.
Update cartesian coord | FFD box: WING. Max Diff: 0.

Design variable (FFD_CONTROL_POINT) number 0.
DRAG gradient : 0
-------------------------------------------------------------------------


https://i.postimg.cc/HxSTSdcq/bwb.png


All times are GMT -4. The time now is 22:30.