Skip to content

Commit af9ee82

Browse files
author
voss_ar
committed
- extending gust to 3D
- fixing 1-cosing gust amplitude
1 parent cc353ee commit af9ee82

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

SU2_CFD/src/iteration/CFluidIteration.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,12 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
318318
// derivatives needed for the source term are calculated when applicable. If the gust derivatives are zero the source
319319
// term is also zero. The source term itself is implemented in the class CSourceWindGust
320320

321-
if (rank == MASTER_NODE) cout << endl << "Running simulation with a Wind Gust." << endl;
322321
unsigned short iDim, nDim = geometry[MESH_0]->GetnDim(); // We assume nDim = 2
323-
if (nDim != 2) {
324-
if (rank == MASTER_NODE) {
325-
cout << endl << "WARNING - Wind Gust capability is only verified for 2 dimensional simulations." << endl;
326-
}
327-
}
322+
// if (nDim != 2) {
323+
// if (rank == MASTER_NODE) {
324+
// cout << endl << "WARNING - Wind Gust capability is only verified for 2 dimensional simulations." << endl;
325+
// }
326+
// }
328327

329328
/*--- Gust Parameters from config ---*/
330329
unsigned short Gust_Type = config->GetGust_Type();
@@ -340,7 +339,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
340339
unsigned long iPoint;
341340
unsigned short iMGlevel, nMGlevel = config->GetnMGLevels();
342341

343-
su2double x, y, x_gust, dgust_dx, dgust_dy, dgust_dt;
342+
su2double x, y, x_gust, dgust_dx, dgust_dy, dgust_dz, dgust_dt;
344343
su2double *Gust, *GridVel, *NewGridVel, *GustDer;
345344

346345
su2double Physical_dt = config->GetDelta_UnstTime();
@@ -358,8 +357,15 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
358357
NewGridVel[iDim] = 0.0;
359358
}
360359

361-
GustDer = new su2double[3];
362-
for (unsigned short i = 0; i < 3; i++) {
360+
// Print some information to check that we are doing the right thing. Not sure how to convert the index back to a string...
361+
if (rank == MASTER_NODE) cout << endl << " Setting up a wind gust type " << Gust_Type << " with amplitude of " << gust_amp << " in direction " << GustDir << endl;
362+
if (rank == MASTER_NODE) cout << " U_inf = " << Uinf << endl;
363+
if (rank == MASTER_NODE) cout << " Physical_t = " << Physical_t << endl;
364+
su2double loc_x = (xbegin + L + Uinf * (Physical_t - tbegin));
365+
if (rank == MASTER_NODE) cout << " Location_x = " << loc_x << endl;
366+
367+
GustDer = new su2double[4];
368+
for (unsigned short i = 0; i < 4; i++) {
363369
GustDer[i] = 0.0;
364370
}
365371

@@ -393,6 +399,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
393399
}
394400
dgust_dx = 0.0;
395401
dgust_dy = 0.0;
402+
dgust_dz = 0.0;
396403
dgust_dt = 0.0;
397404

398405
/*--- Begin applying the gust ---*/
@@ -429,7 +436,7 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
429436
case ONE_M_COSINE:
430437
// Check if we are in the region where the gust is active
431438
if (x_gust > 0 && x_gust < n) {
432-
Gust[GustDir] = gust_amp * (1 - cos(2 * PI_NUMBER * x_gust));
439+
Gust[GustDir] = gust_amp * 0.5 * (1 - cos(2 * PI_NUMBER * x_gust));
433440

434441
// Gust derivatives
435442
// dgust_dx = gust_amp*2*PI_NUMBER*(sin(2*PI_NUMBER*x_gust))/L;
@@ -473,8 +480,9 @@ void CFluidIteration::SetWind_GustField(CConfig* config, CGeometry** geometry, C
473480

474481
GustDer[0] = dgust_dx;
475482
GustDer[1] = dgust_dy;
476-
GustDer[2] = dgust_dt;
477-
483+
GustDer[2] = dgust_dz;
484+
GustDer[3] = dgust_dt;
485+
// 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.
478486
solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGust(iPoint, Gust);
479487
solver[iMGlevel][FLOW_SOL]->GetNodes()->SetWindGustDer(iPoint, GustDer);
480488

0 commit comments

Comments
 (0)