Skip to content

Commit ef83a78

Browse files
committed
Added regression test; ran pre-commit
1 parent 1846cc1 commit ef83a78

File tree

5 files changed

+179
-25
lines changed

5 files changed

+179
-25
lines changed

Common/src/CConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6691,7 +6691,7 @@ void CConfig::SetOutput(SU2_COMPONENT val_software, unsigned short val_izone) {
66916691
if ((Design_Variable[iDV] == NO_DEFORMATION) ||
66926692
(Design_Variable[iDV] == FFD_SETTING) ||
66936693
(Design_Variable[iDV] == SCALE) ) nParamDV = 0;
6694-
if ((Design_Variable[iDV] == ANGLE_OF_ATTACK) ||
6694+
if ((Design_Variable[iDV] == ANGLE_OF_ATTACK) ||
66956695
(Design_Variable[iDV] == HICKS_HENNE_CAMBER)) nParamDV = 1;
66966696
if ((Design_Variable[iDV] == FFD_CAMBER_2D) ||
66976697
(Design_Variable[iDV] == FFD_THICKNESS_2D) ||

Common/src/grid_movement/CSurfaceMovement.cpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,14 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
640640
break;
641641
}
642642
}
643-
643+
644644
/*--- HICKS_HENNE_CAMBER design variable ---*/
645-
645+
646646
if (config->GetDesign_Variable(0) == HICKS_HENNE_CAMBER) {
647647
SetHicksHenneCamber(geometry, config);
648648
}
649649
}
650650

651-
652651
/*--- NACA_4Digits design variable ---*/
653652

654653
else if (config->GetDesign_Variable(0) == NACA_4DIGITS) {
@@ -673,8 +672,6 @@ vector<vector<su2double> > CSurfaceMovement::SetSurface_Deformation(CGeometry* g
673672
if (rank == MASTER_NODE) cout << "No surface deformation (setting FFD)." << endl;
674673
}
675674

676-
677-
678675
/*--- Scale, Translate, and Rotate will be done with rigid mesh transforms. ---*/
679676

680677
else if ((config->GetDesign_Variable(0) == ROTATION) || (config->GetDesign_Variable(0) == TRANSLATION) ||
@@ -2770,8 +2767,6 @@ void CSurfaceMovement::SetHicksHenne(CGeometry* boundary, CConfig* config, unsig
27702767
}
27712768
}
27722769

2773-
2774-
27752770
#ifdef HAVE_MPI
27762771

27772772
int iProcessor, nProcessor = size;
@@ -3711,8 +3706,8 @@ void CSurfaceMovement::SetHicksHenneCamber(CGeometry* boundary, CConfig* config)
37113706
unsigned long iVertex;
37123707
unsigned short iMarker, nDV_Camber = 0;
37133708
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;
3709+
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},
3710+
LSTPCoord[2] = {0.0, 0.0}, Distance, Chord, AoA, ValCos, ValSin;
37163711
vector<su2double> positions, values, X_Coord_upper, Y_Coord_upper, X_Coord_lower, Y_Coord_lower;
37173712

37183713
// --- Check if the type of design variables is only HICKS_HENNE_CAMBER ---// // TODO: Extend to CAMBER + THICKNESS
@@ -3728,16 +3723,15 @@ void CSurfaceMovement::SetHicksHenneCamber(CGeometry* boundary, CConfig* config)
37283723
values.resize(nDV_Camber);
37293724

37303725
/*--- Collect the values of the Hicks-Henne camber design variables ---*/
3731-
for (unsigned short iDV = 0, counter = 0; iDV < config->GetnDV(); iDV++){
3726+
for (unsigned short iDV = 0, counter = 0; iDV < config->GetnDV(); iDV++) {
37323727
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 ---*/
3728+
positions[counter] =
3729+
config->GetParamDV(iDV, 0); /*--- Position of the camber point as a fraction of the chord ---*/
37343730
values[counter] = config->GetDV_Value(iDV); /*--- Value of the deformation ---*/
37353731
counter++;
37363732
}
37373733
}
37383734

3739-
3740-
37413735
/*--- Compute the angle of attack, Leading-edge (LP) and Trailing-edge (TP) point.
37423736
We do this for upper and lower surface separately to detect blunt trailing edges ---*/
37433737

@@ -3750,7 +3744,7 @@ void CSurfaceMovement::SetHicksHenneCamber(CGeometry* boundary, CConfig* config)
37503744
USTPCoord[1] = CoordTrans[1];
37513745
for (iVertex = 1; iVertex < boundary->nVertex[iMarker]; iVertex++) {
37523746
CoordTrans = boundary->vertex[iMarker][iVertex]->GetCoord();
3753-
NormalTrans = boundary->vertex[iMarker][0]->GetNormal();
3747+
NormalTrans = boundary->vertex[iMarker][0]->GetNormal();
37543748
if ((CoordTrans[0] > TPCoord[0]) && (abs(NormalTrans[1]) > abs(NormalTrans[0]))) {
37553749
if (NormalTrans[1] >= 0.0) {
37563750
USTPCoord[0] = CoordTrans[0];
@@ -3785,37 +3779,37 @@ void CSurfaceMovement::SetHicksHenneCamber(CGeometry* boundary, CConfig* config)
37853779
LPCoord[1] = CoordTrans[1];
37863780
}
37873781
}
3788-
}
3782+
}
37893783
}
3790-
3784+
37913785
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 ---*/
3786+
3787+
/*--- Apply deformation based on the camberline Hicks-Henne deformation and the existing airfoil thickness
3788+
* distribution ---*/
37943789
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
37953790
for (iVertex = 0; iVertex < boundary->nVertex[iMarker]; iVertex++) {
37963791
if (config->GetMarker_All_DV(iMarker) == YES) {
37973792
CoordTrans = boundary->vertex[iMarker][iVertex]->GetCoord();
37983793
NormalTrans = boundary->vertex[iMarker][iVertex]->GetNormal();
3799-
3794+
38003795
ValCos = cos(AoA * PI_NUMBER / 180.0);
3801-
ValSin = sin(AoA * PI_NUMBER / 180.0);
3796+
ValSin = sin(AoA * PI_NUMBER / 180.0);
38023797

38033798
/*--- Transform the coordinates ---*/
38043799
Coord[0] = (CoordTrans[0] - LPCoord[0]) * ValCos - (CoordTrans[1] - LPCoord[1]) * ValSin;
38053800
Coord[0] = max(0.0, Coord[0]); // Coord x should be always positive
38063801
Coord[1] = (CoordTrans[1] - LPCoord[1]) * ValCos + (CoordTrans[0] - LPCoord[0]) * ValSin;
38073802

38083803
/*--- Special case: surface point is part of trailing edge ---*/
3809-
if (Coord[0] > 0.99) {
3804+
if (Coord[0] > 0.99) {
38103805
continue;
3811-
}
3806+
}
38123807

38133808
/*--- Compute the Hicks-Henne bumps ---*/
38143809
fk = 0.0;
38153810
for (unsigned short iDV = 0; iDV < nDV_Camber; iDV++) {
38163811
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];
3812+
if (Coord[0] > 10 * EPS) fk += pow(sin(PI_NUMBER * pow(Coord[0], ek)), 3) * values[iDV];
38193813
}
38203814
VarCoord[1] = fk;
38213815
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% %
3+
% SU2 configuration file %
4+
% Case description: Transonic inviscid flow around a NACA0012 airfoil %
5+
% Author: Thomas D. Economon %
6+
% Institution: Stanford University %
7+
% Date: 2014.06.11 %
8+
% File Version 8.2.0 "Harrier" %
9+
% %
10+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11+
12+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
13+
%
14+
SOLVER= EULER
15+
MATH_PROBLEM= DIRECT
16+
RESTART_SOL= NO
17+
18+
% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------%
19+
%
20+
MACH_NUMBER= 0.8
21+
AOA= 1.25
22+
FREESTREAM_PRESSURE= 101325.0
23+
FREESTREAM_TEMPERATURE= 273.15
24+
25+
% -------------- COMPRESSIBLE AND INCOMPRESSIBLE FLUID CONSTANTS --------------%
26+
%
27+
GAMMA_VALUE= 1.4
28+
GAS_CONSTANT= 287.87
29+
30+
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
31+
%
32+
REF_ORIGIN_MOMENT_X = 0.25
33+
REF_ORIGIN_MOMENT_Y = 0.00
34+
REF_ORIGIN_MOMENT_Z = 0.00
35+
REF_LENGTH= 1.0
36+
REF_AREA= 1.0
37+
REF_DIMENSIONALIZATION= DIMENSIONAL
38+
39+
% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------%
40+
%
41+
MARKER_EULER= ( airfoil )
42+
MARKER_FAR= ( farfield )
43+
44+
% ------------------------ SURFACES IDENTIFICATION ----------------------------%
45+
%
46+
MARKER_PLOTTING = ( airfoil )
47+
MARKER_MONITORING = ( airfoil )
48+
MARKER_DESIGNING = ( airfoil )
49+
50+
% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------%
51+
%
52+
NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES
53+
OBJECTIVE_FUNCTION= DRAG
54+
CFL_NUMBER= 4.0
55+
ITER= 250
56+
57+
% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
58+
%
59+
LINEAR_SOLVER= FGMRES
60+
LINEAR_SOLVER_PREC= LU_SGS
61+
LINEAR_SOLVER_ERROR= 1E-6
62+
LINEAR_SOLVER_ITER= 5
63+
64+
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
65+
%
66+
MGLEVEL= 3
67+
MGCYCLE= W_CYCLE
68+
MG_PRE_SMOOTH= ( 1, 2, 3, 3 )
69+
MG_POST_SMOOTH= ( 0, 0, 0, 0 )
70+
MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 )
71+
MG_DAMP_RESTRICTION= 1.0
72+
MG_DAMP_PROLONGATION= 1.0
73+
74+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
75+
%
76+
CONV_NUM_METHOD_FLOW= JST
77+
JST_SENSOR_COEFF= ( 0.5, 0.02 )
78+
TIME_DISCRE_FLOW= EULER_IMPLICIT
79+
80+
% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------%
81+
%
82+
CONV_NUM_METHOD_ADJFLOW= JST
83+
ADJ_JST_SENSOR_COEFF= ( 0.5, 0.02 )
84+
CFL_REDUCTION_ADJFLOW= 0.5
85+
TIME_DISCRE_ADJFLOW= EULER_IMPLICIT
86+
87+
% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------%
88+
%
89+
DV_KIND= HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER, HICKS_HENNE_CAMBER
90+
DV_MARKER= ( airfoil )
91+
DV_PARAM= ( 0.06666666666666667 ); ( 0.13333333333333333 ); ( 0.2 ); ( 0.26666666666666666 ); ( 0.3333333333333333 ); ( 0.4 ); ( 0.4666666666666667 ); ( 0.5333333333333333 ); ( 0.6 ); ( 0.6666666666666666 ); ( 0.7333333333333333 ); ( 0.8 ); ( 0.8666666666666667 ); ( 0.9333333333333333 )
92+
DV_VALUE= 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, 0.005
93+
94+
% ------------------------ GRID DEFORMATION PARAMETERS ------------------------%
95+
%
96+
DEFORM_LINEAR_SOLVER= FGMRES
97+
DEFORM_LINEAR_SOLVER_PREC= LU_SGS
98+
DEFORM_LINEAR_SOLVER_ITER= 1000
99+
DEFORM_NONLINEAR_ITER= 1
100+
DEFORM_CONSOLE_OUTPUT= YES
101+
DEFORM_LINEAR_SOLVER_ERROR= 1E-14
102+
DEFORM_COEFF = 1E6
103+
DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME
104+
105+
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
106+
%
107+
CONV_RESIDUAL_MINVAL= -8
108+
CONV_STARTITER= 10
109+
CONV_CAUCHY_ELEMS= 100
110+
CONV_CAUCHY_EPS= 1E-6
111+
112+
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
113+
%
114+
MESH_FILENAME= mesh_NACA0012_inv.su2
115+
MESH_FORMAT= SU2
116+
MESH_OUT_FILENAME= mesh_out.su2
117+
SOLUTION_FILENAME= solution_flow.dat
118+
SOLUTION_ADJ_FILENAME= solution_adj.dat
119+
TABULAR_FORMAT= CSV
120+
CONV_FILENAME= history
121+
RESTART_FILENAME= restart_flow.dat
122+
RESTART_ADJ_FILENAME= restart_adj.dat
123+
VOLUME_FILENAME= flow
124+
VOLUME_ADJ_FILENAME= adjoint
125+
GRAD_OBJFUNC_FILENAME= of_grad.dat
126+
SURFACE_FILENAME= surface_flow
127+
SURFACE_ADJ_FILENAME= surface_adjoint
128+
OUTPUT_WRT_FREQ= 250
129+
130+
% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------%
131+
%
132+
OPT_OBJECTIVE= DRAG * 0.001
133+
OPT_CONSTRAINT= ( LIFT > 0.328188 ) * 0.001; ( MOMENT_Z > 0.034068 ) * 0.001; ( AIRFOIL_THICKNESS > 0.11 ) * 0.001
134+
DEFINITION_DV= ( 37, 1.0 | airfoil | 0.06666666666666667 ); ( 37, 1.0 | airfoil | 0.13333333333333333 ); ( 37, 1.0 | airfoil | 0.2 ); ( 37, 1.0 | airfoil | 0.26666666666666666 ); ( 37, 1.0 | airfoil | 0.3333333333333333 ); ( 37, 1.0 | airfoil | 0.4 ); ( 37, 1.0 | airfoil | 0.4666666666666667 ); ( 37, 1.0 | airfoil | 0.5333333333333333 ); ( 37, 1.0 | airfoil | 0.6 ); ( 37, 1.0 | airfoil | 0.6666666666666666 ); ( 37, 1.0 | airfoil | 0.7333333333333333 ); ( 37, 1.0 | airfoil | 0.8 ); ( 37, 1.0 | airfoil | 0.8666666666666667 ); ( 37, 1.0 | airfoil | 0.9333333333333333 )

TestCases/parallel_regression.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,19 @@ def main():
17151715
pass_list.append(naca0012_def.run_def())
17161716
test_list.append(naca0012_def)
17171717

1718+
# Inviscid NACA0012 based on Camberline deformation (triangles)
1719+
naca0012_def_file_camber = TestCase('naca0012_def_camber')
1720+
naca0012_def_file_camber.cfg_dir = "deformation/naca0012"
1721+
naca0012_def_file_camber.cfg_file = "def_NACA0012_camber.cfg"
1722+
naca0012_def_file_camber.test_iter = 10
1723+
naca0012_def_file_camber.test_vals = [0.00854844]
1724+
naca0012_def_file_camber.command = TestCase.Command("mpirun -n 2", "SU2_DEF")
1725+
naca0012_def_file_camber.timeout = 1600
1726+
naca0012_def_file_camber.tol = 1e-8
1727+
1728+
pass_list.append(naca0012_def_file_camber.run_def())
1729+
test_list.append(naca0012_def_file_camber)
1730+
17181731
# Inviscid NACA0012 based on SURFACE_FILE input (surface_bump.dat)
17191732
naca0012_def_file = TestCase('naca0012_def_file')
17201733
naca0012_def_file.cfg_dir = "deformation/naca0012"

TestCases/serial_regression.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,19 @@ def main():
12561256
pass_list.append(naca0012_def.run_def(args.tsan, args.asan))
12571257
test_list.append(naca0012_def)
12581258

1259+
# Inviscid NACA0012 based on Camberline deformation (triangles)
1260+
naca0012_def_camber = TestCase('naca0012_def_camber')
1261+
naca0012_def_camber.cfg_dir = "deformation/naca0012"
1262+
naca0012_def_camber.cfg_file = "def_NACA0012_camber.cfg"
1263+
naca0012_def_camber.test_iter = 10
1264+
naca0012_def_camber.test_vals = [0.0201692]
1265+
naca0012_def_camber.command = TestCase.Command(exec = "SU2_DEF")
1266+
naca0012_def_camber.timeout = 1600
1267+
naca0012_def_camber.tol = 1e-06
1268+
1269+
pass_list.append(naca0012_def_camber.run_def(args.tsan, args.asan))
1270+
test_list.append(naca0012_def_camber)
1271+
12591272
# Inviscid NACA0012 based on SURFACE_FILE input (surface_bump.dat)
12601273
naca0012_def_file = TestCase('naca0012_def_file')
12611274
naca0012_def_file.cfg_dir = "deformation/naca0012"

0 commit comments

Comments
 (0)