Skip to content

Commit 3a5b668

Browse files
authored
Merge pull request #1571 from lkusch/fix_axisymmetric_adjoint
Fix for discrete adjoint: axisymmetry + SST turbulence model
2 parents 4c3311f + 27d35a2 commit 3a5b668

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ JonathanSmith1936
9191
Kedar Naik
9292
LaSerpe
9393
Lennaert Tol
94+
Lisa Kusch
9495
Matteo Pini
9596
Max Aehle
9697
Max Le

Common/src/CConfig.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3375,6 +3375,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
33753375
SU2_MPI::Error("A turbulence model must be specified with KIND_TURB_MODEL if SOLVER= INC_RANS", CURRENT_FUNCTION);
33763376
}
33773377

3378+
/*--- Check if turbulence model can be used for AXISYMMETRIC case---*/
3379+
if (Axisymmetric && Kind_Turb_Model != TURB_MODEL::NONE && Kind_Turb_Model != TURB_MODEL::SST && Kind_Turb_Model != TURB_MODEL::SST_SUST){
3380+
SU2_MPI::Error("Axisymmetry is currently only supported for KIND_TURB_MODEL chosen as SST or SST_SUST", CURRENT_FUNCTION);
3381+
}
3382+
33783383
/*--- Set the boolean Wall_Functions equal to true if there is a
33793384
definition for the wall founctions ---*/
33803385

SU2_CFD/include/numerics/turbulent/turb_sources.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,10 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
599599
if (Coord_i[1] < EPS) return;
600600

601601
AD::SetPreaccIn(Coord_i[1]);
602+
AD::SetPreaccIn(V_i[idx.Velocity() + 1]);
602603

603604
const su2double yinv = 1.0 / Coord_i[1];
604-
const su2double rhov = Density_i * V_i[2];
605+
const su2double rhov = Density_i * V_i[idx.Velocity() + 1];
605606
const su2double& k = ScalarVar_i[0];
606607
const su2double& w = ScalarVar_i[1];
607608

@@ -611,7 +612,7 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
611612

612613
/*--- Production ---*/
613614
const su2double pk_axi = max(
614-
0.0, 2.0 / 3.0 * rhov * k * ((2.0 * yinv * V_i[2] - PrimVar_Grad_i[2][1] - PrimVar_Grad_i[1][0]) / zeta - 1.0));
615+
0.0, 2.0 / 3.0 * rhov * k * ((2.0 * yinv * V_i[idx.Velocity() + 1] - PrimVar_Grad_i[idx.Velocity()+1][1] - PrimVar_Grad_i[idx.Velocity()][0]) / zeta - 1.0));
615616
const su2double pw_axi = alfa_blended * zeta / k * pk_axi;
616617

617618
/*--- Convection-Diffusion ---*/

TestCases/axisymmetric_rans/air_nozzle/air_nozzle.cfg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ SOLVER= RANS
1919
% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP)
2020
KIND_TURB_MODEL= SST
2121
%
22-
% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT)
23-
MATH_PROBLEM= DIRECT
24-
%
2522
% Restart solution (NO, YES)
2623
RESTART_SOL= YES
2724
%
@@ -208,4 +205,4 @@ SOLUTION_FILENAME= solution_flow.dat
208205
OUTPUT_WRT_FREQ= 1000
209206
%
210207
% Screen output
211-
SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, RMS_TKE, RMS_DISSIPATION)
208+
SCREEN_OUTPUT= (INNER_ITER, RMS_DENSITY, RMS_ENERGY, RMS_TKE, RMS_DISSIPATION, RMS_ADJ_DENSITY, RMS_ADJ_ENERGY, RMS_ADJ_TKE, RMS_ADJ_DISSIPATION)

TestCases/parallel_regression_AD.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ def main():
168168
discadj_incomp_turb_NACA0012_sst.tol = 0.00001
169169
test_list.append(discadj_incomp_turb_NACA0012_sst)
170170

171+
####################################################################
172+
### Disc. Adj. Axisymmetric RANS ###
173+
####################################################################
174+
175+
# Adjoint Axisymmetric RANS
176+
discadj_axisymmetric_rans_nozzle = TestCase('discadj_axisymmetric_rans')
177+
discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle"
178+
discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle.cfg"
179+
discadj_axisymmetric_rans_nozzle.test_iter = 10
180+
discadj_axisymmetric_rans_nozzle.test_vals = [-10.391857, -15.524696, -7.715907, -17.350541]
181+
discadj_axisymmetric_rans_nozzle.su2_exec = "mpirun -n 2 SU2_CFD_AD"
182+
discadj_axisymmetric_rans_nozzle.timeout = 1600
183+
discadj_axisymmetric_rans_nozzle.tol = 0.00001
184+
discadj_axisymmetric_rans_nozzle.no_restart = True
185+
test_list.append(discadj_axisymmetric_rans_nozzle)
186+
171187
#######################################################
172188
### Unsteady Disc. adj. compressible RANS ###
173189
#######################################################

0 commit comments

Comments
 (0)