Skip to content

Commit 34435af

Browse files
authored
Merge pull request #2538 from JanRotti/develop
Camberline Hicks-Henne Parameterization as design feature
2 parents a0e588d + 14651c3 commit 34435af

File tree

12 files changed

+317
-6
lines changed

12 files changed

+317
-6
lines changed

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,15 +620,15 @@ class CPhysicalGeometry final : public CGeometry {
620620

621621
/*!
622622
* \brief Compute the maximum thickness of an airfoil.
623-
* \return Maximum thickness at a particular seccion.
623+
* \return Maximum thickness at a particular section.
624624
*/
625625
su2double Compute_MaxThickness(su2double* Plane_P0, su2double* Plane_Normal, CConfig* config,
626626
vector<su2double>& Xcoord_Airfoil, vector<su2double>& Ycoord_Airfoil,
627627
vector<su2double>& Zcoord_Airfoil) override;
628628

629629
/*!
630630
* \brief Compute the twist of an airfoil.
631-
* \return Twist at a particular seccion.
631+
* \return Twist at a particular section.
632632
*/
633633
su2double Compute_Twist(su2double* Plane_P0, su2double* Plane_Normal, vector<su2double>& Xcoord_Airfoil,
634634
vector<su2double>& Ycoord_Airfoil, vector<su2double>& Zcoord_Airfoil) override;
@@ -708,7 +708,7 @@ class CPhysicalGeometry final : public CGeometry {
708708

709709
/*!
710710
* \brief Compute the dihedral of a wing.
711-
* \return Dihedral at a particular seccion.
711+
* \return Dihedral at a particular section.
712712
*/
713713
su2double Compute_Dihedral(su2double* LeadingEdge_im1, su2double* TrailingEdge_im1, su2double* LeadingEdge_i,
714714
su2double* TrailingEdge_i) override;

Common/include/grid_movement/CSurfaceMovement.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ class CSurfaceMovement : public CGridMovement {
9595
*/
9696
void SetCST(CGeometry* boundary, CConfig* config, unsigned short iDV, bool ResetDef);
9797

98+
/*!
99+
* \brief Set a Hicks-Henne deformation bump function on the camberline of an airfoil.
100+
* \param[in] boundary - Geometry of the boundary.
101+
* \param[in] config - Definition of the particular problem.
102+
*/
103+
void SetHicksHenneCamber(CGeometry* boundary, CConfig* config);
104+
98105
/*!
99106
* \brief Set a NACA 4 digits airfoil family for airfoil deformation.
100107
* \param[in] boundary - Geometry of the boundary.

Common/include/option_structure.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,6 +2287,7 @@ enum ENUM_PARAM {
22872287
CST = 34, /*!< \brief CST method with Kulfan parameters for airfoil deformation. */
22882288
SURFACE_BUMP = 35, /*!< \brief Surfacebump function for flat surfaces deformation. */
22892289
SURFACE_FILE = 36, /*!< \brief Nodal coordinates for surface set using a file (external parameterization). */
2290+
HICKS_HENNE_CAMBER = 37, /*!< \brief Hicks-Henne bump function for camber line deformation. */
22902291
DV_EFIELD = 40, /*!< \brief Electric field in deformable membranes. */
22912292
DV_YOUNG = 41,
22922293
DV_POISSON = 42,
@@ -2304,6 +2305,7 @@ static const MapType<std::string, ENUM_PARAM> Param_Map = {
23042305
MakePair("FFD_CAMBER_2D", FFD_CAMBER_2D)
23052306
MakePair("FFD_THICKNESS_2D", FFD_THICKNESS_2D)
23062307
MakePair("HICKS_HENNE", HICKS_HENNE)
2308+
MakePair("HICKS_HENNE_CAMBER", HICKS_HENNE_CAMBER)
23072309
MakePair("SURFACE_BUMP", SURFACE_BUMP)
23082310
MakePair("ANGLE_OF_ATTACK", ANGLE_OF_ATTACK)
23092311
MakePair("NACA_4DIGITS", NACA_4DIGITS)

Common/include/option_structure.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
2727
*/
2828

29+
#include "option_structure.hpp"
2930
#include "parallelization/mpi_structure.hpp"
3031
using namespace std;
3132

@@ -570,6 +571,9 @@ class COptionDVParam : public COptionBase {
570571
case HICKS_HENNE:
571572
nParamDV[iDV] = 2;
572573
break;
574+
case HICKS_HENNE_CAMBER:
575+
nParamDV[iDV] = 1;
576+
break;
573577
case SURFACE_BUMP:
574578
nParamDV[iDV] = 3;
575579
break;

Common/src/CConfig.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2372,6 +2372,7 @@ void CConfig::SetConfig_Options() {
23722372
- FFD_CAMBER_2D ( FFDBox ID, i_Ind )
23732373
- FFD_THICKNESS_2D ( FFDBox ID, i_Ind )
23742374
- HICKS_HENNE ( Lower Surface (0)/Upper Surface (1)/Only one Surface (2), x_Loc )
2375+
- HICKS_HENNE_CAMBER ( x_Loc )
23752376
- SURFACE_BUMP ( x_start, x_end, x_Loc )
23762377
- CST ( Lower Surface (0)/Upper Surface (1), Kulfan parameter number, Total number of Kulfan parameters for surface )
23772378
- NACA_4DIGITS ( 1st digit, 2nd digit, 3rd and 4th digit )
@@ -6695,6 +6696,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
66956696
case FFD_CAMBER_2D: cout << "FFD 2D (camber) <-> "; break;
66966697
case FFD_THICKNESS_2D: cout << "FFD 2D (thickness) <-> "; break;
66976698
case HICKS_HENNE: cout << "Hicks Henne <-> " ; break;
6699+
case HICKS_HENNE_CAMBER: cout << "Hicks Henne (camber) <-> " ; break;
66986700
case SURFACE_BUMP: cout << "Surface bump <-> " ; break;
66996701
case ANGLE_OF_ATTACK: cout << "Angle of attack <-> " ; break;
67006702
case CST: cout << "Kulfan parameter number (CST) <-> " ; break;
@@ -6730,7 +6732,8 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
67306732
if ((Design_Variable[iDV] == NO_DEFORMATION) ||
67316733
(Design_Variable[iDV] == FFD_SETTING) ||
67326734
(Design_Variable[iDV] == SCALE) ) nParamDV = 0;
6733-
if (Design_Variable[iDV] == ANGLE_OF_ATTACK) nParamDV = 1;
6735+
if ((Design_Variable[iDV] == ANGLE_OF_ATTACK) ||
6736+
(Design_Variable[iDV] == HICKS_HENNE_CAMBER)) nParamDV = 1;
67346737
if ((Design_Variable[iDV] == FFD_CAMBER_2D) ||
67356738
(Design_Variable[iDV] == FFD_THICKNESS_2D) ||
67366739
(Design_Variable[iDV] == HICKS_HENNE) ||

Common/src/grid_movement/CSurfaceMovement.cpp

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
36993828
void CSurfaceMovement::SetNACA_4Digits(CGeometry* boundary, CConfig* config) {
37003829
unsigned long iVertex;
37013830
unsigned short iMarker;

SU2_DEF/src/drivers/CDiscAdjDeformationDriver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,10 @@ void CDiscAdjDeformationDriver::SetProjection_FD(CGeometry* geometry, CConfig* c
563563
surface_movement->SetRotation(geometry, config, iDV, true);
564564
}
565565

566+
else if (config->GetDesign_Variable(iDV) == HICKS_HENNE_CAMBER) {
567+
surface_movement->SetHicksHenneCamber(geometry, config);
568+
}
569+
566570
/*--- NACA_4Digits design variable. ---*/
567571

568572
else if (config->GetDesign_Variable(iDV) == NACA_4DIGITS) {

SU2_GEO/src/SU2_GEO.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,17 @@ int main(int argc, char* argv[]) {
934934
surface_movement->SetRotation(geometry_container[ZONE_0], config_container[ZONE_0], iDV, true);
935935
}
936936

937+
/*--- HICKS_HENNE_CAMBER design variable ---*/
938+
939+
else if (config_container[ZONE_0]->GetDesign_Variable(iDV) == HICKS_HENNE_CAMBER) {
940+
if (rank == MASTER_NODE) {
941+
cout << endl << "Design variable number " << iDV << "." << endl;
942+
cout << "Perform 2D deformation of the surface." << endl;
943+
}
944+
MoveSurface = true;
945+
surface_movement->SetHicksHenneCamber(geometry_container[ZONE_0], config_container[ZONE_0]);
946+
}
947+
937948
/*--- NACA_4Digits design variable ---*/
938949

939950
else if (config_container[ZONE_0]->GetDesign_Variable(iDV) == NACA_4DIGITS) {

SU2_PY/SU2/io/tools.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ def get_dvMap():
600600
34: "CST",
601601
35: "SURFACE_BUMP",
602602
36: "SURFACE_FILE",
603+
37: "HICKS_HENNE_CAMBER",
603604
40: "DV_EFIELD",
604605
41: "DV_YOUNG",
605606
42: "DV_POISSON",
@@ -722,6 +723,9 @@ def get_gradFileFormat(grad_type, plot_format, kindID, special_cases=[]):
722723
elif kindID == "HICKS_HENNE":
723724
header.append(r',"Up/Down","Loc_Max"')
724725
write_format.append(r", %s, %s")
726+
if kindID == "HICKS_HENNE_CAMBER":
727+
header.append(r',"Loc_Max"')
728+
write_format.append(r", %s")
725729
elif kindID == "SURFACE_BUMP":
726730
header.append(r',"Loc_Start","Loc_End","Loc_Max"')
727731
write_format.append(r", %s, %s, %s")

0 commit comments

Comments
 (0)