Skip to content

Commit c435309

Browse files
authored
Merge pull request #1954 from ArneVoss/feature_3D_gust
Implementing the gust encounter for 3D meshes and for free-flying, elastic aircraft
2 parents c06c6ff + 498065d commit c435309

7 files changed

Lines changed: 291 additions & 29 deletions

File tree

Common/include/option_structure.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,13 @@ static const MapType<std::string, ENUM_GUST_TYPE> Gust_Type_Map = {
779779
*/
780780
enum ENUM_GUST_DIR {
781781
X_DIR = 0, /*!< \brief Gust direction-X. */
782-
Y_DIR = 1 /*!< \brief Gust direction-Y. */
782+
Y_DIR = 1, /*!< \brief Gust direction-Y. */
783+
Z_DIR = 2 /*!< \brief Gust direction-Z. */
783784
};
784785
static const MapType<std::string, ENUM_GUST_DIR> Gust_Dir_Map = {
785786
MakePair("X_DIR", X_DIR)
786787
MakePair("Y_DIR", Y_DIR)
788+
MakePair("Z_DIR", Z_DIR)
787789
};
788790

789791
// If you add to ENUM_CENTERED, you must also add the option to ENUM_CONVECTIVE

SU2_CFD/src/iteration/CFluidIteration.cpp

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
302302
// derivatives needed for the source term are calculated when applicable. If the gust derivatives are zero the source
303303
// term is also zero. The source term itself is implemented in the class CSourceWindGust
304304

305-
if (rank == MASTER_NODE) cout << endl << "Running simulation with a Wind Gust." << endl;
306-
unsigned short iDim, nDim = geometry[MESH_0]->GetnDim(); // We assume nDim = 2
307-
if (nDim != 2) {
308-
if (rank == MASTER_NODE) {
309-
cout << endl << "WARNING - Wind Gust capability is only verified for 2 dimensional simulations." << endl;
310-
}
311-
}
305+
unsigned short iDim, nDim = geometry[MESH_0]->GetnDim();
312306

313307
/*--- Gust Parameters from config ---*/
314308
unsigned short Gust_Type = config->GetGust_Type();
@@ -324,7 +318,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
324318
unsigned long iPoint;
325319
unsigned short iMGlevel, nMGlevel = config->GetnMGLevels();
326320

327-
su2double x, y, x_gust, dgust_dx, dgust_dy, dgust_dt;
321+
su2double x, y, x_gust, dgust_dx, dgust_dy, dgust_dz, dgust_dt;
328322
su2double *Gust, *GridVel, *NewGridVel, *GustDer;
329323

330324
su2double Physical_dt = config->GetDelta_UnstTime();
@@ -335,16 +329,17 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
335329

336330
su2double Uinf = solver[MESH_0][FLOW_SOL]->GetVelocity_Inf(0); // Assumption gust moves at infinity velocity
337331

338-
Gust = new su2double[nDim];
339-
NewGridVel = new su2double[nDim];
340-
for (iDim = 0; iDim < nDim; iDim++) {
341-
Gust[iDim] = 0.0;
342-
NewGridVel[iDim] = 0.0;
343-
}
344-
345-
GustDer = new su2double[3];
346-
for (unsigned short i = 0; i < 3; i++) {
347-
GustDer[i] = 0.0;
332+
Gust = new su2double[nDim]();
333+
NewGridVel = new su2double[nDim]();
334+
GustDer = new su2double[nDim+1]();
335+
336+
// Print some information to check that we are doing the right thing. Not sure how to convert the index back to a string...
337+
if (rank == MASTER_NODE) {
338+
cout << endl << "Setting up a wind gust type " << Gust_Type << " with amplitude of " << gust_amp << " in direction " << GustDir << endl;
339+
cout << " U_inf = " << Uinf << endl;
340+
cout << " Physical_t = " << Physical_t << endl;
341+
su2double loc_x = (xbegin + L + Uinf * (Physical_t - tbegin));
342+
cout << " Location_x = " << loc_x << endl;
348343
}
349344

350345
// Vortex variables
@@ -366,7 +361,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
366361

367362
for (iPoint = 0; iPoint < geometry[iMGlevel]->GetnPoint(); iPoint++) {
368363
/*--- Reset the Grid Velocity to zero if there is no grid movement ---*/
369-
if (Kind_Grid_Movement == GUST && !(config->GetFSI_Simulation())) {
364+
if (Kind_Grid_Movement == GUST && !(config->GetFSI_Simulation()) && !(config->GetDeform_Mesh())) {
370365
for (iDim = 0; iDim < nDim; iDim++) geometry[iMGlevel]->nodes->SetGridVel(iPoint, iDim, 0.0);
371366
}
372367

@@ -377,6 +372,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
377372
}
378373
dgust_dx = 0.0;
379374
dgust_dy = 0.0;
375+
dgust_dz = 0.0;
380376
dgust_dt = 0.0;
381377

382378
/*--- Begin applying the gust ---*/
@@ -413,7 +409,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
413409
case ONE_M_COSINE:
414410
// Check if we are in the region where the gust is active
415411
if (x_gust > 0 && x_gust < n) {
416-
Gust[GustDir] = gust_amp * (1 - cos(2 * PI_NUMBER * x_gust));
412+
Gust[GustDir] = gust_amp * 0.5 * (1 - cos(2 * PI_NUMBER * x_gust));
417413

418414
// Gust derivatives
419415
// dgust_dx = gust_amp*2*PI_NUMBER*(sin(2*PI_NUMBER*x_gust))/L;
@@ -454,11 +450,18 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
454450
}
455451

456452
/*--- Set the Wind Gust, Wind Gust Derivatives and the Grid Velocities ---*/
457-
458-
GustDer[0] = dgust_dx;
459-
GustDer[1] = dgust_dy;
460-
GustDer[2] = dgust_dt;
461-
453+
if (nDim == 2) {
454+
GustDer[0] = dgust_dx;
455+
GustDer[1] = dgust_dy;
456+
GustDer[2] = dgust_dt;
457+
}
458+
else {
459+
GustDer[0] = dgust_dx;
460+
GustDer[1] = dgust_dy;
461+
GustDer[2] = dgust_dz;
462+
GustDer[3] = dgust_dt;
463+
}
464+
// I think we don't need to set any source terms because they depend on the derivatives, which are zero in all cases from above.
462465
solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGust(iPoint, Gust);
463466
solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGustDer(iPoint, GustDer);
464467

SU2_CFD/src/numerics/flow/flow_sources.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,13 @@ CNumerics::ResidualType<> CSourceWindGust::ComputeResidual(const CConfig* config
783783
residual[2] = smy*Volume;
784784
//residual[3] = smz*Volume;
785785
residual[3] = se*Volume;
786-
} else {
787-
SU2_MPI::Error("You should only be in the gust source term in two dimensions", CURRENT_FUNCTION);
786+
}
787+
else {
788+
residual[0] = 0.0;
789+
residual[1] = 0.0;
790+
residual[2] = 0.0;
791+
residual[3] = 0.0;
792+
residual[4] = 0.0;
788793
}
789794

790795
/*--- For now the source term Jacobian is just set to zero ---*/
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% %
3+
% SU2 configuration file %
4+
% Case description: Cosine gust in z-direction of a 3D mesh %
5+
% Author: Arne Voß %
6+
% Institution: DLR %
7+
% Date: 25.05.2023 %
8+
% File Version 7.5.1 "Blackbird" %
9+
% %
10+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11+
12+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
13+
%
14+
SOLVER= EULER
15+
MATH_PROBLEM= DIRECT
16+
%
17+
RESTART_SOL= YES
18+
RESTART_ITER= 72
19+
%
20+
% ------------------------------- SOLVER CONTROL ------------------------------%
21+
%
22+
INNER_ITER= 30
23+
CONV_RESIDUAL_MINVAL= -6
24+
CONV_STARTITER= 0
25+
%
26+
% ------------------------- UNSTEADY SIMULATION -------------------------------%
27+
%
28+
TIME_DOMAIN=YES
29+
TIME_MARCHING= DUAL_TIME_STEPPING-2ND_ORDER
30+
TIME_STEP= 0.001
31+
TIME_ITER= 80
32+
%
33+
% --------------------------- GUST SIMULATION ---------------------------------%
34+
%
35+
% The gust simulation requires the GRID_MOVEMENT flag to be set to YES.
36+
% and the GRID_MOVEMENT_KIND to be set to GUST or any of the other options.
37+
% Apply a wind gust (NO, YES)
38+
GRID_MOVEMENT=GUST
39+
WIND_GUST= YES
40+
GUST_TYPE= ONE_M_COSINE
41+
GUST_DIR= Z_DIR
42+
GUST_WAVELENGTH= 5.0
43+
GUST_PERIODS= 1.0
44+
% Gust amplitude corresponds to ~2.0 deg AoA
45+
GUST_AMPL= 2.37
46+
%
47+
GUST_BEGIN_TIME= 0.0
48+
% Gust is placed 5m ahead of the wing
49+
GUST_BEGIN_LOC=-10.0
50+
% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
51+
%
52+
MACH_NUMBER= 0.2
53+
AOA= 0.0
54+
SIDESLIP_ANGLE= 0.0
55+
FREESTREAM_OPTION= DENSITY_FS
56+
FREESTREAM_PRESSURE= 101325.0
57+
FREESTREAM_DENSITY= 1.225
58+
FREESTREAM_TEMPERATURE= 288.15
59+
%
60+
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
61+
%
62+
REF_ORIGIN_MOMENT_X = 0.25
63+
REF_ORIGIN_MOMENT_Y = 0.00
64+
REF_ORIGIN_MOMENT_Z = 0.00
65+
REF_LENGTH= 1.0
66+
REF_AREA= 3.0
67+
SEMI_SPAN= 1.5
68+
REF_DIMENSIONALIZATION= DIMENSIONAL
69+
70+
% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
71+
%
72+
MARKER_EULER= ( wing, tip)
73+
MARKER_FAR= ( far_away )
74+
75+
% ------------------------ SURFACES IDENTIFICATION ----------------------------%
76+
%
77+
MARKER_PLOTTING = ( wing, tip )
78+
MARKER_MONITORING = ( wing, tip )
79+
80+
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
81+
%
82+
CFL_NUMBER= 1000.0
83+
CFL_ADAPT= YES
84+
%
85+
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
86+
%
87+
MGLEVEL= 3
88+
MGCYCLE= W_CYCLE
89+
90+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
91+
%
92+
CONV_NUM_METHOD_FLOW= JST
93+
LINEAR_SOLVER_ITER= 20
94+
%
95+
% ------------------------- SCREEN/HISTORY VOLUME OUTPUT --------------------------%
96+
%
97+
SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, LIFT, MOMENT_X, MOMENT_Y, MOMENT_Z)
98+
HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF, CAUCHY, WALL_TIME)
99+
%
100+
% ------------------------- INPUT/OUTPUT FILE INFORMATION --------------------------%
101+
%
102+
MESH_FILENAME= mesh_rectangular_wing.su2
103+
MESH_FORMAT= SU2
104+
SOLUTION_FILENAME= restart_gust.dat
105+
RESTART_FILENAME= restart_gust.dat
106+
SURFACE_FILENAME= surface_gust
107+
VOLUME_FILENAME= volume_gust
108+
CONV_FILENAME= history_gust
109+
TABULAR_FORMAT= CSV
110+
OUTPUT_FILES= (RESTART, RESTART_ASCII)
111+
%
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% %
3+
% SU2 configuration file %
4+
% Case description: Cosine gust combined with mesh deformation %
5+
% Author: Arne Voß %
6+
% Institution: DLR %
7+
% Date: 25.05.2023 %
8+
% File Version 7.5.1 "Blackbird" %
9+
% %
10+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11+
12+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
13+
%
14+
SOLVER= EULER
15+
MATH_PROBLEM= DIRECT
16+
% ------------------------------- SOLVER CONTROL ------------------------------%
17+
%
18+
INNER_ITER= 100
19+
CONV_RESIDUAL_MINVAL= -6
20+
CONV_STARTITER= 0
21+
%
22+
% ------------------------- UNSTEADY SIMULATION -------------------------------%
23+
%
24+
TIME_DOMAIN=YES
25+
TIME_MARCHING= DUAL_TIME_STEPPING-2ND_ORDER
26+
TIME_STEP= 0.001
27+
TIME_ITER= 7
28+
%
29+
% --------------------------- GUST SIMULATION ---------------------------------%
30+
%
31+
% The gust simulation requires the GRID_MOVEMENT flag to be set to YES.
32+
% and the GRID_MOVEMENT_KIND to be set to GUST or any of the other options.
33+
% Apply a wind gust (NO, YES)
34+
GRID_MOVEMENT=GUST
35+
WIND_GUST= YES
36+
GUST_TYPE= ONE_M_COSINE
37+
GUST_DIR= Y_DIR
38+
GUST_WAVELENGTH= 5.0
39+
GUST_PERIODS= 1.0
40+
GUST_AMPL= 1.0
41+
GUST_BEGIN_TIME= 0.0
42+
GUST_BEGIN_LOC=-5.0
43+
%
44+
% --------------------------- MESH DEFORMATION--------------------------------%
45+
% Type of dynamic surface movement (NONE, DEFORMING, MOVING_WALL,
46+
% AEROELASTIC, AEROELASTIC_RIGID_MOTION EXTERNAL, EXTERNAL_ROTATION)
47+
SURFACE_MOVEMENT= DEFORMING
48+
%
49+
% Moving wall boundary marker(s) (NONE = no marker, ignored for RIGID_MOTION)
50+
MARKER_MOVING= ( airfoil )
51+
%
52+
% Plunging angular freq. (rad/s) in x, y, & z directions
53+
SURFACE_PLUNGING_OMEGA= 0.0 125.6 0.0
54+
%
55+
% Plunging amplitude (m or ft) in x, y, & z directions
56+
SURFACE_PLUNGING_AMPL= 0.0 0.0001 0.0
57+
%
58+
% Move Motion Origin for marker moving (1 or 0)
59+
MOVE_MOTION_ORIGIN = 0
60+
%
61+
% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
62+
%
63+
MACH_NUMBER= 0.2
64+
AOA= 0.0
65+
SIDESLIP_ANGLE= 0.0
66+
FREESTREAM_OPTION= DENSITY_FS
67+
FREESTREAM_PRESSURE= 101325.0
68+
FREESTREAM_DENSITY= 1.225
69+
FREESTREAM_TEMPERATURE= 288.15
70+
%
71+
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
72+
%
73+
REF_ORIGIN_MOMENT_X = 0.25
74+
REF_ORIGIN_MOMENT_Y = 0.00
75+
REF_ORIGIN_MOMENT_Z = 0.00
76+
REF_LENGTH= 1.0
77+
REF_AREA= 1.0
78+
SEMI_SPAN= 1.0
79+
REF_DIMENSIONALIZATION= DIMENSIONAL
80+
%
81+
% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
82+
%
83+
MARKER_EULER= ( airfoil )
84+
MARKER_FAR= ( farfield )
85+
%
86+
% ------------------------ SURFACES IDENTIFICATION ----------------------------%
87+
%
88+
MARKER_PLOTTING = ( airfoil )
89+
MARKER_MONITORING = ( airfoil )
90+
%
91+
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
92+
%
93+
CFL_NUMBER= 100.0
94+
CFL_ADAPT= YES
95+
%
96+
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
97+
%
98+
MGLEVEL= 3
99+
MGCYCLE= W_CYCLE
100+
%
101+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
102+
%
103+
CONV_NUM_METHOD_FLOW= JST
104+
LINEAR_SOLVER_ITER= 20
105+
%
106+
% ------------------------- SCREEN/HISTORY VOLUME OUTPUT --------------------------%
107+
%
108+
SCREEN_OUTPUT= (TIME_ITER, INNER_ITER, RMS_DENSITY, LIFT, MOMENT_Z)
109+
HISTORY_OUTPUT= (ITER, RMS_RES, AERO_COEFF, CAUCHY, WALL_TIME)
110+
%
111+
% ------------------------- INPUT/OUTPUT FILE INFORMATION --------------------------%
112+
%
113+
MESH_FILENAME= mesh_NACA0012_inv.su2
114+
MESH_FORMAT= SU2
115+
SOLUTION_FILENAME= restart_gust.dat
116+
RESTART_FILENAME= restart_gust.dat
117+
SURFACE_FILENAME= surface_gust
118+
VOLUME_FILENAME= volume_gust
119+
CONV_FILENAME= history_gust
120+
TABULAR_FORMAT= CSV
121+
OUTPUT_FILES= (NONE)
122+
%

TestCases/hybrid_regression.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,24 @@ def main():
470470
sine_gust.test_vals = [-1.977520, 3.481804, -0.012402, -0.007454]
471471
sine_gust.unsteady = True
472472
test_list.append(sine_gust)
473+
474+
# Cosine gust in z-direction
475+
cosine_gust = TestCase('cosine_gust_zdir')
476+
cosine_gust.cfg_dir = "gust"
477+
cosine_gust.cfg_file = "cosine_gust_zdir.cfg"
478+
cosine_gust.test_iter = 79
479+
cosine_gust.test_vals = [-2.418813, 0.004650, -0.001878, -0.000637, -0.000271]
480+
cosine_gust.unsteady = True
481+
test_list.append(cosine_gust)
482+
483+
# Gust with mesh deformation
484+
gust_mesh_defo = TestCase('gust_with_mesh_deformation')
485+
gust_mesh_defo.cfg_dir = "gust"
486+
gust_mesh_defo.cfg_file = "gust_with_mesh_deformation.cfg"
487+
gust_mesh_defo.test_iter = 6
488+
gust_mesh_defo.test_vals = [-1.844778, 0.000846, -0.000408]
489+
gust_mesh_defo.unsteady = True
490+
test_list.append(gust_mesh_defo)
473491

474492
# Aeroelastic
475493
aeroelastic = TestCase('aeroelastic')

0 commit comments

Comments
 (0)