Skip to content

Commit c8ccde5

Browse files
authored
Merge pull request #1563 from su2code/fix_2d_periodic_rotation
Fix 2D rotational periodicity
2 parents a288828 + 2a6da92 commit c8ccde5

6 files changed

Lines changed: 3467 additions & 1 deletion

File tree

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
468468
ordering is rotation about the x-axis, y-axis, then z-axis. ---*/
469469

470470
if (nDim==2) {
471-
GeometryToolbox::RotationMatrix(Theta, rotMatrix2D);
471+
GeometryToolbox::RotationMatrix(Psi, rotMatrix2D);
472472
} else {
473473
GeometryToolbox::RotationMatrix(Theta, Phi, Psi, rotMatrix3D);
474474
}
@@ -738,6 +738,22 @@ void CSolver::InitiatePeriodicComms(CGeometry *geometry,
738738
Rotate(zeros, jacBlock[iVar], rotBlock[iVar]);
739739
}
740740

741+
/*--- Rotate the vector components of the solution. ---*/
742+
743+
if (rotate_periodic) {
744+
for (iDim = 0; iDim < nDim; iDim++) {
745+
su2double d_diDim[3] = {0.0};
746+
for (iVar = 1; iVar < 1+nDim; ++iVar) {
747+
d_diDim[iVar-1] = rotBlock(iVar, iDim);
748+
}
749+
su2double rotated[3] = {0.0};
750+
Rotate(zeros, d_diDim, rotated);
751+
for (iVar = 1; iVar < 1+nDim; ++iVar) {
752+
rotBlock(iVar, iDim) = rotated[iVar-1];
753+
}
754+
}
755+
}
756+
741757
/*--- Store the partial gradient in the buffer. ---*/
742758

743759
for (iVar = 0; iVar < ICOUNT; iVar++) {

TestCases/hybrid_regression.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ def main():
134134
poiseuille_profile.test_vals = [-12.494752, -7.712204, -0.000000, 2.085796]
135135
test_list.append(poiseuille_profile)
136136

137+
# 2D Rotational Periodic
138+
periodic2d = TestCase('periodic2d')
139+
periodic2d.cfg_dir = "navierstokes/periodic2D"
140+
periodic2d.cfg_file = "config.cfg"
141+
periodic2d.test_iter = 1400
142+
periodic2d.test_vals = [-10.818511, -8.363385, -8.287482, -5.334813, -1.087926, -2945.2]
143+
test_list.append(periodic2d)
144+
137145
##########################
138146
### Compressible RANS ###
139147
##########################
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
%
3+
SOLVER= NAVIER_STOKES
4+
KIND_TURB_MODEL= NONE
5+
RESTART_SOL= NO
6+
7+
% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
8+
%
9+
MACH_NUMBER= 0.1
10+
AOA= 22.5
11+
INIT_OPTION= TD_CONDITIONS
12+
FREESTREAM_OPTION= TEMPERATURE_FS
13+
FREESTREAM_TEMPERATURE= 300
14+
FREESTREAM_PRESSURE= 99000
15+
16+
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
17+
%
18+
REF_ORIGIN_MOMENT_X = 0.00
19+
REF_ORIGIN_MOMENT_Y = 0.00
20+
REF_ORIGIN_MOMENT_Z = 0.00
21+
REF_LENGTH= 1
22+
REF_AREA= 1
23+
%
24+
FLUID_MODEL= IDEAL_GAS
25+
GAMMA_VALUE= 1.4
26+
GAS_CONSTANT= 287.87
27+
VISCOSITY_MODEL= CONSTANT_VISCOSITY
28+
MU_CONSTANT= 0.001
29+
30+
% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
31+
%
32+
MARKER_PERIODIC= ( per1, per2, 0,0,0, 0,0,45, 0,0,0 )
33+
MARKER_OUTLET= ( outlet, 99000.0 )
34+
INLET_TYPE= TOTAL_CONDITIONS
35+
MARKER_INLET= ( inlet, 300, 100000, 1, 0, 0 )
36+
SPECIFIED_INLET_PROFILE= YES
37+
INLET_FILENAME= inlet.dat
38+
%
39+
MARKER_ANALYZE= ( outlet, inlet )
40+
41+
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
42+
%
43+
NUM_METHOD_GRAD= GREEN_GAUSS
44+
CFL_NUMBER= 100
45+
CFL_ADAPT= NO
46+
TIME_DISCRE_FLOW= EULER_IMPLICIT
47+
48+
% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
49+
%
50+
LINEAR_SOLVER= FGMRES
51+
LINEAR_SOLVER_PREC= LU_SGS
52+
LINEAR_SOLVER_ERROR= 0.1
53+
LINEAR_SOLVER_ITER= 4
54+
55+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
56+
%
57+
CONV_NUM_METHOD_FLOW= ROE
58+
USE_VECTORIZATION= YES
59+
MUSCL_FLOW= YES
60+
SLOPE_LIMITER_FLOW= VENKATAKRISHNAN_WANG
61+
VENKAT_LIMITER_COEFF= 0.05
62+
63+
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
64+
%
65+
CONV_RESIDUAL_MINVAL= -11
66+
CONV_STARTITER= 0
67+
INNER_ITER= 5000
68+
69+
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
70+
%
71+
MESH_FORMAT= SU2
72+
MESH_FILENAME= sector.su2
73+
OUTPUT_WRT_FREQ= 9999
74+
%
75+
SCREEN_OUTPUT= ( INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X, RMS_MOMENTUM-Y,\
76+
RMS_ENERGY, LINSOL_RESIDUAL, SURFACE_PRESSURE_DROP )
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
NMARK= 1
2+
MARKER_TAG= inlet
3+
NROW=40
4+
NCOL=6
5+
# COORD-X COORD-Y TEMPERATURE PRESSURE NORMAL-X NORMAL-Y
6+
2.5000000E-01 0.0000000E+00 3.00E+02 1.00E+05 0.25881905 0.96592583
7+
2.4994931E-01 5.0342633E-03 3.00E+02 1.00E+05 0.23931566 0.97094182
8+
2.4979725E-01 1.0066485E-02 3.00E+02 1.00E+05 0.21971523 0.97556405
9+
2.4954389E-01 1.5094624E-02 3.00E+02 1.00E+05 0.20002569 0.97979065
10+
2.4918933E-01 2.0116642E-02 3.00E+02 1.00E+05 0.18025504 0.98361991
11+
2.4873371E-01 2.5130502E-02 3.00E+02 1.00E+05 0.16041128 0.98705026
12+
2.4817722E-01 3.0134170E-02 3.00E+02 1.00E+05 0.14050247 0.99008033
13+
2.4752008E-01 3.5125618E-02 3.00E+02 1.00E+05 0.12053668 0.99270887
14+
2.4676257E-01 4.0102820E-02 3.00E+02 1.00E+05 0.10052201 0.99493484
15+
2.4590498E-01 4.5063760E-02 3.00E+02 1.00E+05 0.08046657 0.99675731
16+
2.4494766E-01 5.0006424E-02 3.00E+02 1.00E+05 0.06037850 0.99817555
17+
2.4389101E-01 5.4928808E-02 3.00E+02 1.00E+05 0.04026594 0.99918900
18+
2.4273545E-01 5.9828916E-02 3.00E+02 1.00E+05 0.02013705 0.99979723
19+
2.4148146E-01 6.4704761E-02 3.00E+02 1.00E+05 0.00000000 1.00000000
20+
2.4012953E-01 6.9554366E-02 3.00E+02 1.00E+05 -0.02013705 0.99979723
21+
2.3868022E-01 7.4375764E-02 3.00E+02 1.00E+05 -0.04026594 0.99918900
22+
2.3713411E-01 7.9166999E-02 3.00E+02 1.00E+05 -0.06037850 0.99817555
23+
2.3549184E-01 8.3926128E-02 3.00E+02 1.00E+05 -0.08046657 0.99675731
24+
2.3375406E-01 8.8651222E-02 3.00E+02 1.00E+05 -0.10052201 0.99493484
25+
2.3192149E-01 9.3340364E-02 3.00E+02 1.00E+05 -0.12053668 0.99270887
26+
2.2999486E-01 9.7991653E-02 3.00E+02 1.00E+05 -0.14050247 0.99008033
27+
2.2797496E-01 1.0260320E-01 3.00E+02 1.00E+05 -0.16041128 0.98705026
28+
2.2586261E-01 1.0717314E-01 3.00E+02 1.00E+05 -0.18025504 0.98361991
29+
2.2365866E-01 1.1169962E-01 3.00E+02 1.00E+05 -0.20002569 0.97979065
30+
2.2136401E-01 1.1618079E-01 3.00E+02 1.00E+05 -0.21971523 0.97556405
31+
2.1897958E-01 1.2061485E-01 3.00E+02 1.00E+05 -0.23931566 0.97094182
32+
2.1650635E-01 1.2500000E-01 3.00E+02 1.00E+05 -0.25881905 0.96592583
33+
2.1394532E-01 1.2933445E-01 3.00E+02 1.00E+05 -0.27821746 0.96051811
34+
2.1129752E-01 1.3361646E-01 3.00E+02 1.00E+05 -0.29750305 0.95472087
35+
2.0856403E-01 1.3784427E-01 3.00E+02 1.00E+05 -0.31666799 0.94853644
36+
2.0574597E-01 1.4201619E-01 3.00E+02 1.00E+05 -0.33570451 0.94196735
37+
2.0284446E-01 1.4613051E-01 3.00E+02 1.00E+05 -0.35460489 0.93501624
38+
1.9986069E-01 1.5018557E-01 3.00E+02 1.00E+05 -0.37336146 0.92768595
39+
1.9679587E-01 1.5417972E-01 3.00E+02 1.00E+05 -0.39196661 0.91997944
40+
1.9365124E-01 1.5811134E-01 3.00E+02 1.00E+05 -0.41041281 0.91189985
41+
1.9042808E-01 1.6197885E-01 3.00E+02 1.00E+05 -0.42869256 0.90345043
42+
1.8712769E-01 1.6578066E-01 3.00E+02 1.00E+05 -0.44679846 0.89463464
43+
1.8375141E-01 1.6951525E-01 3.00E+02 1.00E+05 -0.46472317 0.88545603
44+
1.8030061E-01 1.7318109E-01 3.00E+02 1.00E+05 -0.48245941 0.87591833
45+
1.7677670E-01 1.7677670E-01 3.00E+02 1.00E+05 -0.50000000 0.86602540
46+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Gmsh .geo script
2+
ri = 0.25;
3+
ro = 0.5;
4+
N = 40;
5+
6+
Point(1) = {0.0, 0.0, 0.0, 1.0};
7+
Point(2) = {ri, 0.0, 0.0, 1.0};
8+
Point(3) = {ro, 0.0, 0.0, 1.0};
9+
Point(4) = {ro/Sqrt(2), ro/Sqrt(2), 0.0, 1.0};
10+
Point(5) = {ri/Sqrt(2), ri/Sqrt(2), 0.0, 1.0};
11+
12+
Circle(1) = {2, 1, 5};
13+
Circle(2) = {3, 1, 4};
14+
Line(3) = {2, 3};
15+
Line(4) = {5, 4};
16+
17+
Curve Loop(1) = {4, -2, -3, 1};
18+
Surface(1) = {1};
19+
20+
Physical Curve("inlet", 5) = {1};
21+
Physical Curve("outlet", 6) = {2};
22+
Physical Curve("per1", 7) = {3};
23+
Physical Curve("per2", 8) = {4};
24+
Physical Surface("fluid", 9) = {1};
25+
26+
Transfinite Curve {1, 2} = N Using Progression 1;
27+
Transfinite Curve {3, 4} = N Using Progression 1;
28+
Transfinite Surface {1};
29+
Recombine Surface {1};
30+
31+
Mesh 2;

0 commit comments

Comments
 (0)