# How does SU2 calculate of_gradient.plt?

 Register Blogs Members List Search Today's Posts Mark Forums Read July 8, 2013, 09:27 How does SU2 calculate of_gradient.plt?
#1
Member

Roberto Pieri
Join Date: Feb 2012
Location: Milan
Posts: 57
Rep Power: 13 Hi developers,

I don't understand how SU2 evaluates objective functions gradient. I thought it simply evaluates shape sensitivity at each position of design variable and imposes this value as of Hicks-Henne bump functions, but in SU2_GPC I found these lines:

Code:
		/*--- Continuous adjoint gradient computation ---*/
if (rank == MASTER_NODE)
cout << "Evaluate functional gradient using the continuous adjoint strategy." << endl;

/*--- Load the delta change in the design variable (finite difference step).
Note that this assumes DV_Value_New = finite_diff_step and DV_Value_Old = 0.0
in the config file. ---*/
delta_eps = config->GetDV_Value_New(iDV);

/*--- Reset update points ---*/
for (iPoint = 0; iPoint < boundary->GetnPoint(); iPoint++)
UpdatePoint[iPoint] = true;

for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if (config->GetMarker_All_Moving(iMarker) == YES) {
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {

iPoint = boundary->vertex[iMarker][iVertex]->GetNode();
if ((iPoint < boundary->GetnPointDomain()) && UpdatePoint[iPoint]) {

Normal = boundary->vertex[iMarker][iVertex]->GetNormal();
VarCoord = boundary->vertex[iMarker][iVertex]->GetVarCoord();
Sensitivity = boundary->vertex[iMarker][iVertex]->GetAuxVar();

dS = 0.0;
for (iDim = 0; iDim < boundary->GetnDim(); iDim++) {
dS += Normal[iDim]*Normal[iDim];
deps[iDim] = VarCoord[iDim] / delta_eps;
}
dS = sqrt(dS);

dalpha_deps = 0.0;
for (iDim = 0; iDim < boundary->GetnDim(); iDim++) {
dalpha[iDim] = Normal[iDim] / dS;
dalpha_deps -= dalpha[iDim]*deps[iDim];
}

UpdatePoint[iPoint] = false;
}
}
}
}
Does this imply that the deformation , deps in the code, is projected along the surface normal and then multiplied by Sensitivity? Why does this operation is needed since shape sensitivity is a gradient expressing the maximum change in the objective function due to a normal deformation?

In the picture attached below you find shape sensitivity with DRAG as objective function in blue, of_gradient in red. I don't understand why gradient evaluation doesn't follow shape sensitivity.

Cheers,
Roberto
Attached Images CdGradient.jpg (38.1 KB, 57 views)   July 25, 2013, 13:03 #2 Member   Trent Lukaczyk Join Date: Feb 2011 Location: Stanford, CA Posts: 75 Rep Power: 14 hi roberto, the adjoint approach implemented in SU2 solves for the sensitivity of a chosen objective to perturbations of the surface in the local normal direction. this must be chain ruled with the sensitivity of the surface to changes in the chosen design parameterization (ie hicks-henne bump function). to find this sensitivity SU2 uses a finite difference approximation, which is what the code snippet you quoted is doing. the size of the step used by SU2_GPC is chosen by the config option DV_VALUE_NEW. in previous studies we've seen that the accuracy of the overall design gradient is insensitive to the size of this step. the plot you show is showing two different types of sensitivities. the solid line is showing the surface sensitivity (the first one i mentioned), and the x-axis is displacement tangent along the surface. the points are showing the overall design gradient, and the x-axis is the design variable index -trent   August 21, 2013, 12:52 #3 New Member   MENDES BORTOLAZZI Andre Join Date: Jun 2013 Posts: 7 Rep Power: 11 Hi developers, Also concerning the gradients, I have seen that the subroutine that computes VarCoord (grid_movement_structure.cpp >> CSurfaceMovement::SetHicksHenne) evaluates a variation of the node's coordinates as it follows: double Ampl_old = config->GetDV_Value_Old(iDV); double Ampl_new = config->GetDV_Value_New(iDV); double Ampl = Ampl_new - Ampl_old; […] ek = log10(0.5)/log10(xk); fk = pow( sin( PI_NUMBER * pow(Coord,ek) ) , t2); /*--- Upper and lower surface ---*/ if (( upper) && (Normal > 0)) { VarCoord = Ampl*fk; } if ((!upper) && (Normal < 0)) { VarCoord = -Ampl*fk; } Which means that VarCoord is a variation of the coordinates due to a variation ∆δi of the design variable (∆δi=δi new – δi old). Yet, when computing the gradients (SU2_GPC.cpp) , the variable deps is evaluated like this: delta_eps = config->GetDV_Value_New(iDV); […] deps[iDim] = VarCoord[iDim] / delta_eps; } dS = sqrt(dS); dalpha_deps = 0.0; for (iDim = 0; iDim < boundary->GetnDim(); iDim++) { dalpha[iDim] = Normal[iDim] / dS; dalpha_deps -= dalpha[iDim]*deps[iDim]; } my_Gradient += Sensitivity*dalpha_deps; That is, deps = ∆y/δinew = (δi new – δi old)*fk / δinew where fk is the kth bump function. I didn’t understand the meaning of this step. I was expecting to evaluate deps by doing ∆y/(δi new – δi old) instead of doing ∆y/δi new (in order to get the sensitivity of the node’s coordinates w.r.t. the design variable δi). Is there a reason to do it like this? Thanks in advance. Cheers, Andre   August 22, 2013, 05:15 #4 New Member   MENDES BORTOLAZZI Andre Join Date: Jun 2013 Posts: 7 Rep Power: 11 Never mind, this comment in line 184 of SU2_GPC.ccp explains everything: /*--- Load the delta change in the design variable (finite difference step). Note that this assumes DV_Value_New = finite_diff_step and DV_Value_Old = 0.0 in the config file. ---*/ Best regards, Andre   August 26, 2013, 16:22 #5
Super Moderator

Francisco Palacios
Join Date: Jan 2013
Location: Long Beach, CA
Posts: 404
Rep Power: 14 Please note that we have removed the DV_Value_New and DV_Value_Old from the current developer's version. Currently, DV_Value is the only parameter.

Best,
Francisco

Quote:
 Originally Posted by Bortolazzi Never mind, this comment in line 184 of SU2_GPC.ccp explains everything: /*--- Load the delta change in the design variable (finite difference step). Note that this assumes DV_Value_New = finite_diff_step and DV_Value_Old = 0.0 in the config file. ---*/ Best regards, Andre  Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post akail SU2 4 February 18, 2015 13:12 economon SU2 0 January 7, 2013 02:48 pete Site News & Announcements 0 January 5, 2013 17:59 praveen Main CFD Forum 1 May 21, 2012 20:52 sbar OpenFOAM Pre-Processing 5 August 16, 2010 04:10

All times are GMT -4. The time now is 12:49.