@@ -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
0 commit comments