Skip to content

Commit f849a6e

Browse files
authored
Merge pull request #1621 from ArneVoss/feature_free_flying_aircraft
Free-flying aircraft that translates and rotates about the center of gravity (rotating frame + translation)
2 parents 039f972 + 64b2a2b commit f849a6e

4 files changed

Lines changed: 225 additions & 210 deletions

File tree

Common/src/geometry/CGeometry.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,14 +3510,16 @@ void CGeometry::SetRotationalVelocity(const CConfig *config, bool print) {
35103510
unsigned long iPoint;
35113511
unsigned short iDim;
35123512

3513-
su2double RotVel[3] = {0.0,0.0,0.0}, Distance[3] = {0.0,0.0,0.0},
3514-
Center[3] = {0.0,0.0,0.0}, Omega[3] = {0.0,0.0,0.0};
3513+
su2double GridVel[3] = {0.0,0.0,0.0}, Distance[3] = {0.0,0.0,0.0},
3514+
Center[3] = {0.0,0.0,0.0}, Omega[3] = {0.0,0.0,0.0},
3515+
xDot[3] = {0.0,0.0,0.0};
35153516

35163517
/*--- Center of rotation & angular velocity vector from config ---*/
35173518

35183519
for (iDim = 0; iDim < 3; iDim++) {
35193520
Center[iDim] = config->GetMotion_Origin(iDim);
35203521
Omega[iDim] = config->GetRotation_Rate(iDim)/config->GetOmega_Ref();
3522+
xDot[iDim] = config->GetTranslation_Rate(iDim)/config->GetVelocity_Ref();
35213523
}
35223524

35233525
su2double L_Ref = config->GetLength_Ref();
@@ -3529,9 +3531,11 @@ void CGeometry::SetRotationalVelocity(const CConfig *config, bool print) {
35293531
cout << ", " << Center[2] << " )\n";
35303532
cout << " Angular velocity about x, y, z axes: ( " << Omega[0] << ", ";
35313533
cout << Omega[1] << ", " << Omega[2] << " ) rad/s" << endl;
3534+
cout << " Translational velocity in x, y, z direction: ("
3535+
<< xDot[0] << ", " << xDot[1] << ", " << xDot[2] << ")." << endl;
35323536
}
35333537

3534-
/*--- Loop over all nodes and set the rotational velocity ---*/
3538+
/*--- Loop over all nodes and set the rotational and translational velocity ---*/
35353539

35363540
for (iPoint = 0; iPoint < nPoint; iPoint++) {
35373541

@@ -3544,15 +3548,15 @@ void CGeometry::SetRotationalVelocity(const CConfig *config, bool print) {
35443548
for (iDim = 0; iDim < nDim; iDim++)
35453549
Distance[iDim] = (Coord[iDim]-Center[iDim])/L_Ref;
35463550

3547-
/*--- Calculate the angular velocity as omega X r ---*/
3551+
/*--- Calculate the angular velocity as omega X r and add translational velocity ---*/
35483552

3549-
RotVel[0] = Omega[1]*(Distance[2]) - Omega[2]*(Distance[1]);
3550-
RotVel[1] = Omega[2]*(Distance[0]) - Omega[0]*(Distance[2]);
3551-
RotVel[2] = Omega[0]*(Distance[1]) - Omega[1]*(Distance[0]);
3553+
GridVel[0] = Omega[1]*(Distance[2]) - Omega[2]*(Distance[1]) + xDot[0];
3554+
GridVel[1] = Omega[2]*(Distance[0]) - Omega[0]*(Distance[2]) + xDot[1];
3555+
GridVel[2] = Omega[0]*(Distance[1]) - Omega[1]*(Distance[0]) + xDot[2];
35523556

35533557
/*--- Store the grid velocity at this node ---*/
35543558

3555-
nodes->SetGridVel(iPoint, RotVel);
3559+
nodes->SetGridVel(iPoint, GridVel);
35563560

35573561
}
35583562

TestCases/py_wrapper/translating_NACA0012/config.cfg

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ RESTART_SOL= NO
88
% FREE-STREAM DEFINITION
99
%
1010
% We are translating the domain instead of having farfield velocity.
11-
GRID_MOVEMENT= STEADY_TRANSLATION
12-
MOTION_ORIGIN= ( 0.0, 0.0, 0.0 )
13-
TRANSLATION_RATE= ( -264.994, -5.78219, 0.0 )
11+
% Note: The rotating frame is intended for 3D cases. To use the feature in a 2D case,
12+
% care must be taken with respect to the axes, e.g. to obtain a pitching motion, a
13+
% rotation about the z-axis can be used.
14+
GRID_MOVEMENT= ROTATING_FRAME
15+
MOTION_ORIGIN= 0.0, 0.0, 0.0
16+
ROTATION_RATE= 0.0, 0.0, 0.5
17+
TRANSLATION_RATE= -264.994, -5.78219, 0.0
1418
MACH_NUMBER= 0.0
1519
FREESTREAM_PRESSURE= 101325.0
1620
FREESTREAM_TEMPERATURE= 273.15
@@ -68,6 +72,6 @@ CONV_RESIDUAL_MINVAL= -9
6872
%
6973
MESH_FILENAME= ../../euler/naca0012/mesh_NACA0012_inv.su2
7074
MESH_FORMAT= SU2
71-
SCREEN_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG)
75+
SCREEN_OUTPUT= (INNER_ITER, RMS_RES, LIFT, DRAG, MOMENT_X, MOMENT_Y, MOMENT_Z)
7276
HISTORY_OUTPUT= (INNER_ITER, RMS_RES, AERO_COEFF)
7377

0 commit comments

Comments
 (0)