2626 */
2727
2828#include " ../../include/grid_movement/CSurfaceMovement.hpp"
29+ #include < iostream>
2930#include " ../../include/toolboxes/C1DInterpolation.hpp"
3031#include " ../../include/toolboxes/geometry_toolbox.hpp"
3132
@@ -584,7 +585,7 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
584585 else if ((config->GetDesign_Variable (0 ) == ROTATION) || (config->GetDesign_Variable (0 ) == TRANSLATION) ||
585586 (config->GetDesign_Variable (0 ) == SCALE) || (config->GetDesign_Variable (0 ) == HICKS_HENNE) ||
586587 (config->GetDesign_Variable (0 ) == SURFACE_BUMP) || (config->GetDesign_Variable (0 ) == ANGLE_OF_ATTACK) ||
587- (config->GetDesign_Variable (0 ) == CST)) {
588+ (config->GetDesign_Variable (0 ) == CST) || (config-> GetDesign_Variable ( 0 ) == HICKS_HENNE_CAMBER) ) {
588589 /* --- Apply rotation, displacement and stretching design variables (this
589590 should be done before the bump function design variables) ---*/
590591
@@ -639,9 +640,15 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
639640 break ;
640641 }
641642 }
642-
643+
644+ /* --- HICKS_HENNE_CAMBER design variable ---*/
645+
646+ if (config->GetDesign_Variable (0 ) == HICKS_HENNE_CAMBER) {
647+ SetHicksHenneCamber (geometry, config);
648+ }
643649 }
644650
651+
645652 /* --- NACA_4Digits design variable ---*/
646653
647654 else if (config->GetDesign_Variable (0 ) == NACA_4DIGITS) {
@@ -666,6 +673,8 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
666673 if (rank == MASTER_NODE) cout << " No surface deformation (setting FFD)." << endl;
667674 }
668675
676+
677+
669678 /* --- Scale, Translate, and Rotate will be done with rigid mesh transforms. ---*/
670679
671680 else if ((config->GetDesign_Variable (0 ) == ROTATION) || (config->GetDesign_Variable (0 ) == TRANSLATION) ||
@@ -2761,6 +2770,8 @@ void CSurfaceMovement::SetHicksHenne(CGeometry* boundary, CConfig* config, unsig
27612770 }
27622771 }
27632772
2773+
2774+
27642775#ifdef HAVE_MPI
27652776
27662777 int iProcessor, nProcessor = size;
@@ -3696,6 +3707,132 @@ void CSurfaceMovement::SetExternal_Deformation(CGeometry* geometry, CConfig* con
36963707 }
36973708}
36983709
3710+ void CSurfaceMovement::SetHicksHenneCamber (CGeometry* boundary, CConfig* config) {
3711+ unsigned long iVertex;
3712+ unsigned short iMarker, nDV_Camber = 0 ;
3713+ su2double VarCoord[3 ] = {0.0 , 0.0 , 0.0 }, VarCoordTrans[3 ] = {0.0 , 0.0 , 0.0 }, *CoordTrans, *NormalTrans, ek, fk,
3714+ Coord[3 ] = {0.0 , 0.0 , 0.0 }, TPCoord[2 ] = {0.0 , 0.0 }, LPCoord[2 ] = {0.0 , 0.0 },
3715+ USTPCoord[2 ] = {0.0 , 0.0 }, LSTPCoord[2 ] = {0.0 , 0.0 }, Distance, Chord, AoA, ValCos, ValSin;
3716+ vector<su2double> positions, values, X_Coord_upper, Y_Coord_upper, X_Coord_lower, Y_Coord_lower;
3717+
3718+ // --- Check if the type of design variables is only HICKS_HENNE_CAMBER ---// // TODO: Extend to CAMBER + THICKNESS
3719+ for (unsigned short iDV = 0 ; iDV < config->GetnDV (); iDV++)
3720+ if (config->GetDesign_Variable (iDV) != HICKS_HENNE_CAMBER) {
3721+ cout << " 'HicksHenneCamber' can not be combined with other design variables." ;
3722+ cin.get ();
3723+ } else {
3724+ nDV_Camber++;
3725+ }
3726+
3727+ positions.resize (nDV_Camber);
3728+ values.resize (nDV_Camber);
3729+
3730+ /* --- Collect the values of the Hicks-Henne camber design variables ---*/
3731+ for (unsigned short iDV = 0 , counter = 0 ; iDV < config->GetnDV (); iDV++){
3732+ if (config->GetDesign_Variable (iDV) == HICKS_HENNE_CAMBER) {
3733+ positions[counter] = config->GetParamDV (iDV, 0 ); /* --- Position of the camber point as a fraction of the chord ---*/
3734+ values[counter] = config->GetDV_Value (iDV); /* --- Value of the deformation ---*/
3735+ counter++;
3736+ }
3737+ }
3738+
3739+
3740+
3741+ /* --- Compute the angle of attack, Leading-edge (LP) and Trailing-edge (TP) point.
3742+ We do this for upper and lower surface separately to detect blunt trailing edges ---*/
3743+
3744+ for (iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++) {
3745+ if (config->GetMarker_All_DV (iMarker) == YES) {
3746+ CoordTrans = boundary->vertex [iMarker][0 ]->GetCoord ();
3747+ LSTPCoord[0 ] = CoordTrans[0 ];
3748+ LSTPCoord[1 ] = CoordTrans[1 ];
3749+ USTPCoord[0 ] = CoordTrans[0 ];
3750+ USTPCoord[1 ] = CoordTrans[1 ];
3751+ for (iVertex = 1 ; iVertex < boundary->nVertex [iMarker]; iVertex++) {
3752+ CoordTrans = boundary->vertex [iMarker][iVertex]->GetCoord ();
3753+ NormalTrans = boundary->vertex [iMarker][0 ]->GetNormal ();
3754+ if ((CoordTrans[0 ] > TPCoord[0 ]) && (abs (NormalTrans[1 ]) > abs (NormalTrans[0 ]))) {
3755+ if (NormalTrans[1 ] >= 0.0 ) {
3756+ USTPCoord[0 ] = CoordTrans[0 ];
3757+ USTPCoord[1 ] = CoordTrans[1 ];
3758+ } else {
3759+ LSTPCoord[0 ] = CoordTrans[0 ];
3760+ LSTPCoord[1 ] = CoordTrans[1 ];
3761+ }
3762+ }
3763+ }
3764+ }
3765+ }
3766+
3767+ /* --- Correct the TP coordinates if the trailing edge is blunt ---*/
3768+ if ((USTPCoord[0 ] != LSTPCoord[0 ]) || (USTPCoord[1 ] != LSTPCoord[1 ])) {
3769+ TPCoord[0 ] = (USTPCoord[0 ] + LSTPCoord[0 ]) / 2.0 ;
3770+ TPCoord[1 ] = (USTPCoord[1 ] + LSTPCoord[1 ]) / 2.0 ;
3771+ } else {
3772+ TPCoord[0 ] = USTPCoord[0 ];
3773+ TPCoord[1 ] = USTPCoord[1 ];
3774+ }
3775+
3776+ Chord = 0.0 ;
3777+ for (iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++) {
3778+ if (config->GetMarker_All_DV (iMarker) == YES) {
3779+ for (iVertex = 0 ; iVertex < boundary->nVertex [iMarker]; iVertex++) {
3780+ CoordTrans = boundary->vertex [iMarker][iVertex]->GetCoord ();
3781+ Distance = sqrt (pow (CoordTrans[0 ] - TPCoord[0 ], 2.0 ) + pow (CoordTrans[1 ] - TPCoord[1 ], 2.0 ));
3782+ if (Chord < Distance) {
3783+ Chord = Distance;
3784+ LPCoord[0 ] = CoordTrans[0 ];
3785+ LPCoord[1 ] = CoordTrans[1 ];
3786+ }
3787+ }
3788+ }
3789+ }
3790+
3791+ AoA = atan ((LPCoord[1 ] - TPCoord[1 ]) / (TPCoord[0 ] - LPCoord[0 ])) * 180 / PI_NUMBER;
3792+
3793+ /* --- Apply deformation based on the camberline Hicks-Henne deformation and the existing airfoil thickness distribution ---*/
3794+ for (iMarker = 0 ; iMarker < config->GetnMarker_All (); iMarker++) {
3795+ for (iVertex = 0 ; iVertex < boundary->nVertex [iMarker]; iVertex++) {
3796+ if (config->GetMarker_All_DV (iMarker) == YES) {
3797+ CoordTrans = boundary->vertex [iMarker][iVertex]->GetCoord ();
3798+ NormalTrans = boundary->vertex [iMarker][iVertex]->GetNormal ();
3799+
3800+ ValCos = cos (AoA * PI_NUMBER / 180.0 );
3801+ ValSin = sin (AoA * PI_NUMBER / 180.0 );
3802+
3803+ /* --- Transform the coordinates ---*/
3804+ Coord[0 ] = (CoordTrans[0 ] - LPCoord[0 ]) * ValCos - (CoordTrans[1 ] - LPCoord[1 ]) * ValSin;
3805+ Coord[0 ] = max (0.0 , Coord[0 ]); // Coord x should be always positive
3806+ Coord[1 ] = (CoordTrans[1 ] - LPCoord[1 ]) * ValCos + (CoordTrans[0 ] - LPCoord[0 ]) * ValSin;
3807+
3808+ /* --- Special case: surface point is part of trailing edge ---*/
3809+ if (Coord[0 ] > 0.99 ) {
3810+ continue ;
3811+ }
3812+
3813+ /* --- Compute the Hicks-Henne bumps ---*/
3814+ fk = 0.0 ;
3815+ for (unsigned short iDV = 0 ; iDV < nDV_Camber; iDV++) {
3816+ ek = log10 (0.5 ) / log10 (positions[iDV]);
3817+ if (Coord[0 ] > 10 * EPS)
3818+ fk += pow (sin (PI_NUMBER * pow (Coord[0 ], ek)), 3 ) * values[iDV];
3819+ }
3820+ VarCoord[1 ] = fk;
3821+ }
3822+
3823+ /* --- Apply the transformation to the coordinate variation ---*/
3824+
3825+ ValCos = cos (-AoA * PI_NUMBER / 180.0 );
3826+ ValSin = sin (-AoA * PI_NUMBER / 180.0 );
3827+
3828+ VarCoordTrans[0 ] = VarCoord[0 ] * ValCos - VarCoord[1 ] * ValSin;
3829+ VarCoordTrans[1 ] = VarCoord[1 ] * ValCos + VarCoord[0 ] * ValSin;
3830+
3831+ boundary->vertex [iMarker][iVertex]->SetVarCoord (VarCoordTrans);
3832+ }
3833+ }
3834+ }
3835+
36993836void CSurfaceMovement::SetNACA_4Digits (CGeometry* boundary, CConfig* config) {
37003837 unsigned long iVertex;
37013838 unsigned short iMarker;
0 commit comments