@@ -584,7 +584,7 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
584584 else if ((config->GetDesign_Variable (0 ) == ROTATION) || (config->GetDesign_Variable (0 ) == TRANSLATION) ||
585585 (config->GetDesign_Variable (0 ) == SCALE) || (config->GetDesign_Variable (0 ) == HICKS_HENNE) ||
586586 (config->GetDesign_Variable (0 ) == SURFACE_BUMP) || (config->GetDesign_Variable (0 ) == ANGLE_OF_ATTACK) ||
587- (config->GetDesign_Variable (0 ) == CST)) {
587+ (config->GetDesign_Variable (0 ) == CST) || (config-> GetDesign_Variable ( 0 ) == HICKS_HENNE_CAMBER) ) {
588588 /* --- Apply rotation, displacement and stretching design variables (this
589589 should be done before the bump function design variables) ---*/
590590
@@ -640,6 +640,11 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
640640 }
641641 }
642642
643+ /* --- HICKS_HENNE_CAMBER design variable ---*/
644+
645+ if (config->GetDesign_Variable (0 ) == HICKS_HENNE_CAMBER) {
646+ SetHicksHenneCamber (geometry, config);
647+ }
643648 }
644649
645650 /* --- NACA_4Digits design variable ---*/
@@ -3696,6 +3701,130 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry* geometry, CConfig* con
36963701 }
36973702}
36983703
3704+ void CSurfaceMovement::SetHicksHenneCamber (CGeometry* boundary, CConfig* config) {
3705+ unsigned long iVertex;
3706+ unsigned short iMarker, nDV_Camber = 0 ;
3707+ su2double VarCoord[3 ] = {0.0 , 0.0 , 0.0 }, VarCoordTrans[3 ] = {0.0 , 0.0 , 0.0 }, *CoordTrans, *NormalTrans, ek, fk,
3708+ Coord[3 ] = {0.0 , 0.0 , 0.0 }, TPCoord[2 ] = {0.0 , 0.0 }, LPCoord[2 ] = {0.0 , 0.0 }, USTPCoord[2 ] = {0.0 , 0.0 },
3709+ LSTPCoord[2 ] = {0.0 , 0.0 }, Distance, Chord, AoA, ValCos, ValSin;
3710+ vector<su2double> positions, values, X_Coord_upper, Y_Coord_upper, X_Coord_lower, Y_Coord_lower;
3711+
3712+ // --- Check if the type of design variables is only HICKS_HENNE_CAMBER ---// // TODO: Extend to CAMBER + THICKNESS
3713+ for (unsigned short iDV = 0 ; iDV < config->GetnDV (); iDV++)
3714+ if (config->GetDesign_Variable (iDV) != HICKS_HENNE_CAMBER) {
3715+ SU2_MPI::Error (" 'HicksHenneCamber' can not be combined with other design variables." , CURRENT_FUNCTION);
3716+ } else {
3717+ nDV_Camber++;
3718+ }
3719+
3720+ positions.resize (nDV_Camber);
3721+ values.resize (nDV_Camber);
3722+
3723+ /* --- Collect the values of the Hicks-Henne camber design variables ---*/
3724+ for (unsigned short iDV = 0 , counter = 0 ; iDV < config->GetnDV (); iDV++) {
3725+ if (config->GetDesign_Variable (iDV) == HICKS_HENNE_CAMBER) {
3726+ positions[counter] =
3727+ config->GetParamDV (iDV, 0 ); /* --- Position of the camber point as a fraction of the chord ---*/
3728+ values[counter] = config->GetDV_Value (iDV); /* --- Value of the deformation ---*/
3729+ counter++;
3730+ }
3731+ }
3732+
3733+ /* --- Compute the angle of attack, Leading-edge (LP) and Trailing-edge (TP) point.
3734+ We do this for upper and lower surface separately to detect blunt trailing edges ---*/
3735+
3736+ for (iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++) {
3737+ if (config->GetMarker_All_DV (iMarker) == YES) {
3738+ CoordTrans = boundary->vertex [iMarker][0 ]->GetCoord ();
3739+ LSTPCoord[0 ] = CoordTrans[0 ];
3740+ LSTPCoord[1 ] = CoordTrans[1 ];
3741+ USTPCoord[0 ] = CoordTrans[0 ];
3742+ USTPCoord[1 ] = CoordTrans[1 ];
3743+ for (iVertex = 1 ; iVertex < boundary->nVertex [iMarker]; iVertex++) {
3744+ CoordTrans = boundary->vertex [iMarker][iVertex]->GetCoord ();
3745+ NormalTrans = boundary->vertex [iMarker][0 ]->GetNormal ();
3746+ if ((CoordTrans[0 ] > TPCoord[0 ]) && (abs (NormalTrans[1 ]) > abs (NormalTrans[0 ]))) {
3747+ if (NormalTrans[1 ] >= 0.0 ) {
3748+ USTPCoord[0 ] = CoordTrans[0 ];
3749+ USTPCoord[1 ] = CoordTrans[1 ];
3750+ } else {
3751+ LSTPCoord[0 ] = CoordTrans[0 ];
3752+ LSTPCoord[1 ] = CoordTrans[1 ];
3753+ }
3754+ }
3755+ }
3756+ }
3757+ }
3758+
3759+ /* --- Correct the TP coordinates if the trailing edge is blunt ---*/
3760+ if ((fabs (USTPCoord[0 ] - LSTPCoord[0 ]) > EPS) || (fabs (USTPCoord[1 ] - LSTPCoord[1 ]) > EPS)) {
3761+ TPCoord[0 ] = (USTPCoord[0 ] + LSTPCoord[0 ]) / 2.0 ;
3762+ TPCoord[1 ] = (USTPCoord[1 ] + LSTPCoord[1 ]) / 2.0 ;
3763+ } else {
3764+ TPCoord[0 ] = USTPCoord[0 ];
3765+ TPCoord[1 ] = USTPCoord[1 ];
3766+ }
3767+
3768+ Chord = 0.0 ;
3769+ for (iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++) {
3770+ if (config->GetMarker_All_DV (iMarker) == YES) {
3771+ for (iVertex = 0 ; iVertex < boundary->nVertex [iMarker]; iVertex++) {
3772+ CoordTrans = boundary->vertex [iMarker][iVertex]->GetCoord ();
3773+ Distance = GeometryToolbox::Distance (2 , CoordTrans, TPCoord);
3774+ if (Chord < Distance) {
3775+ Chord = Distance;
3776+ LPCoord[0 ] = CoordTrans[0 ];
3777+ LPCoord[1 ] = CoordTrans[1 ];
3778+ }
3779+ }
3780+ }
3781+ }
3782+
3783+ AoA = atan ((LPCoord[1 ] - TPCoord[1 ]) / (TPCoord[0 ] - LPCoord[0 ])) * 180 / PI_NUMBER;
3784+
3785+ /* --- Apply deformation based on the camberline Hicks-Henne deformation and the existing airfoil thickness
3786+ * distribution ---*/
3787+ for (iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++) {
3788+ for (iVertex = 0 ; iVertex < boundary->nVertex [iMarker]; iVertex++) {
3789+ if (config->GetMarker_All_DV (iMarker) == YES) {
3790+ CoordTrans = boundary->vertex [iMarker][iVertex]->GetCoord ();
3791+ NormalTrans = boundary->vertex [iMarker][iVertex]->GetNormal ();
3792+
3793+ ValCos = cos (AoA * PI_NUMBER / 180.0 );
3794+ ValSin = sin (AoA * PI_NUMBER / 180.0 );
3795+
3796+ /* --- Transform the coordinates ---*/
3797+ Coord[0 ] = (CoordTrans[0 ] - LPCoord[0 ]) * ValCos - (CoordTrans[1 ] - LPCoord[1 ]) * ValSin;
3798+ Coord[0 ] = max (0.0 , Coord[0 ]); // Coord x should be always positive
3799+ Coord[1 ] = (CoordTrans[1 ] - LPCoord[1 ]) * ValCos + (CoordTrans[0 ] - LPCoord[0 ]) * ValSin;
3800+
3801+ /* --- Special case: surface point is part of trailing edge ---*/
3802+ if (Coord[0 ] > 0.99 ) {
3803+ continue ;
3804+ }
3805+
3806+ /* --- Compute the Hicks-Henne bumps ---*/
3807+ fk = 0.0 ;
3808+ for (unsigned short iDV = 0 ; iDV < nDV_Camber; iDV++) {
3809+ ek = log10 (0.5 ) / log10 (positions[iDV]);
3810+ if (Coord[0 ] > 10 * EPS) fk += pow (sin (PI_NUMBER * pow (Coord[0 ], ek)), 3 ) * values[iDV];
3811+ }
3812+ VarCoord[1 ] = fk;
3813+ }
3814+
3815+ /* --- Apply the transformation to the coordinate variation ---*/
3816+
3817+ ValCos = cos (-AoA * PI_NUMBER / 180.0 );
3818+ ValSin = sin (-AoA * PI_NUMBER / 180.0 );
3819+
3820+ VarCoordTrans[0 ] = VarCoord[0 ] * ValCos - VarCoord[1 ] * ValSin;
3821+ VarCoordTrans[1 ] = VarCoord[1 ] * ValCos + VarCoord[0 ] * ValSin;
3822+
3823+ boundary->vertex [iMarker][iVertex]->SetVarCoord (VarCoordTrans);
3824+ }
3825+ }
3826+ }
3827+
36993828void CSurfaceMovement::SetNACA_4Digits (CGeometry* boundary, CConfig* config) {
37003829 unsigned long iVertex;
37013830 unsigned short iMarker;
0 commit comments