Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for discrete adjoint: axisymmetry + SST turbulence model #1571

Merged
merged 8 commits into from
Mar 23, 2022
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ JonathanSmith1936
Kedar Naik
LaSerpe
Lennaert Tol
Lisa Kusch
Matteo Pini
Max Aehle
Max Le
Expand Down
5 changes: 5 additions & 0 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3375,6 +3375,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("A turbulence model must be specified with KIND_TURB_MODEL if SOLVER= INC_RANS", CURRENT_FUNCTION);
}

/*--- Check if turbulence model can be used for AXISYMMETRIC case---*/
if (Axisymmetric && Kind_Turb_Model != TURB_MODEL::NONE && Kind_Turb_Model != TURB_MODEL::SST && Kind_Turb_Model != TURB_MODEL::SST_SUST){
SU2_MPI::Error("Axisymmetry is currently only supported for KIND_TURB_MODEL chosen as SST or SST_SUST", CURRENT_FUNCTION);
}

/*--- Set the boolean Wall_Functions equal to true if there is a
definition for the wall founctions ---*/

Expand Down
5 changes: 3 additions & 2 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,10 @@ class CSourcePieceWise_TurbSST final : public CNumerics {
if (Coord_i[1] < EPS) return;

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

const su2double yinv = 1.0 / Coord_i[1];
const su2double rhov = Density_i * V_i[2];
const su2double rhov = Density_i * V_i[idx.Velocity() + 1];
const su2double& k = ScalarVar_i[0];
const su2double& w = ScalarVar_i[1];

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

/*--- Production ---*/
const su2double pk_axi = max(
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));
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));
const su2double pw_axi = alfa_blended * zeta / k * pk_axi;

/*--- Convection-Diffusion ---*/
Expand Down
217 changes: 217 additions & 0 deletions TestCases/axisymmetric_rans/air_nozzle/air_nozzle_adj.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SU2 configuration file %
% Case description: Axisymmetric supersonic converging-diverging air nozzle %
% Author: Florian Dittmann %
% Date: 2021.12.02 %
% File Version 7.3.0 "Blackbird" %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
%
% Physical governing equations (EULER, NAVIER_STOKES,
% FEM_EULER, FEM_NAVIER_STOKES, FEM_RANS, FEM_LES,
% WAVE_EQUATION, HEAT_EQUATION, FEM_ELASTICITY,
% POISSON_EQUATION)
SOLVER= RANS
%
% Specify turbulence model (NONE, SA, SA_NEG, SST, SA_E, SA_COMP, SA_E_COMP)
KIND_TURB_MODEL= SST
%
% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT)
MATH_PROBLEM= DISCRETE_ADJOINT
%
% Restart solution (NO, YES)
RESTART_SOL= NO
%
% System of measurements (SI, US)
% International system of units (SI): ( meters, kilograms, Kelvins,
% Newtons = kg m/s^2, Pascals = N/m^2,
% Density = kg/m^3, Speed = m/s,
% Equiv. Area = m^2 )
% United States customary units (US): ( inches, slug, Rankines, lbf = slug ft/s^2,
% psf = lbf/ft^2, Density = slug/ft^3,
% Speed = ft/s, Equiv. Area = ft^2 )
SYSTEM_MEASUREMENTS= SI
%
AXISYMMETRIC= YES
%
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
%
% Mach number (non-dimensional, based on the free-stream values)
MACH_NUMBER= 1E-9
%
% Angle of attack (degrees, only for compressible flows)
AOA= 0.0
%
% Side-slip angle (degrees, only for compressible flows)
SIDESLIP_ANGLE= 0.0
%
% Init option to choose between Reynolds (default) or thermodynamics quantities
% for initializing the solution (REYNOLDS, TD_CONDITIONS)
INIT_OPTION= TD_CONDITIONS
%
% Free-stream option to choose between density and temperature (default) for
% initializing the solution (TEMPERATURE_FS, DENSITY_FS)
FREESTREAM_OPTION= TEMPERATURE_FS
%
% Free-stream pressure (101325.0 N/m^2, 2116.216 psf by default)
FREESTREAM_PRESSURE= 1400000
%
% Free-stream temperature (288.15 K, 518.67 R by default)
FREESTREAM_TEMPERATURE= 373.15
%
% Compressible flow non-dimensionalization (DIMENSIONAL, FREESTREAM_PRESS_EQ_ONE,
% FREESTREAM_VEL_EQ_MACH, FREESTREAM_VEL_EQ_ONE)
REF_DIMENSIONALIZATION= DIMENSIONAL

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% ---- IDEAL GAS, POLYTROPIC, VAN DER WAALS AND PENG ROBINSON CONSTANTS -------%
%
% Fluid model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS,
% CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY)
FLUID_MODEL= STANDARD_AIR

% --------------------------- VISCOSITY MODEL ---------------------------------%
%
% Viscosity model (SUTHERLAND, CONSTANT_VISCOSITY, POLYNOMIAL_VISCOSITY).
VISCOSITY_MODEL= CONSTANT_VISCOSITY
%
% Molecular Viscosity that would be constant (1.716E-5 by default)
MU_CONSTANT= 1.716E-5

% --------------------------- THERMAL CONDUCTIVITY MODEL ----------------------%
%
% Laminar Conductivity model (CONSTANT_CONDUCTIVITY, CONSTANT_PRANDTL,
% POLYNOMIAL_CONDUCTIVITY).
CONDUCTIVITY_MODEL= CONSTANT_PRANDTL
%
% Laminar Prandtl number (0.72 (air), only for CONSTANT_PRANDTL)
PRANDTL_LAM= 0.72
%
% Turbulent Prandtl number (0.9 (air) by default)
PRANDTL_TURB= 0.90

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
%
% Navier-Stokes (no-slip), constant heat flux wall marker(s) (NONE = no marker)
% Format: ( marker name, constant heat flux (J/m^2), ... )
MARKER_HEATFLUX= ( WALL, 0.0 )
%
% Symmetry boundary marker(s) (NONE = no marker)
MARKER_SYM= ( SYMMETRY )
%
% Riemann boundary marker(s) (NONE = no marker)
% Format: (marker, data kind flag, list of data)
MARKER_RIEMANN= ( INFLOW, TOTAL_CONDITIONS_PT, 1400000.0, 373.15, 1.0, 0.0, 0.0, OUTFLOW, STATIC_PRESSURE, 100000.0, 0.0, 0.0, 0.0, 0.0 )

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
%
% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES)
NUM_METHOD_GRAD= GREEN_GAUSS
%
% CFL number (initial value for the adaptive CFL number)
CFL_NUMBER= 1000.0
%
% Adaptive CFL number (NO, YES)
CFL_ADAPT= NO
%
% Parameters of the adaptive CFL number (factor down, factor up, CFL min value,
% CFL max value )
CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1000.0 )
%
% Maximum Delta Time in local time stepping simulations
MAX_DELTA_TIME= 1E6

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% ----------- SLOPE LIMITER AND DISSIPATION SENSOR DEFINITION -----------------%
%
% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations.
% Required for 2nd order upwind schemes (NO, YES)
MUSCL_FLOW= YES
%
% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG,
% BARTH_JESPERSEN, VAN_ALBADA_EDGE)
SLOPE_LIMITER_FLOW= NONE

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
%
% Linear solver or smoother for implicit formulations (BCGSTAB, FGMRES, SMOOTHER_JACOBI,
% SMOOTHER_ILU, SMOOTHER_LUSGS,
% SMOOTHER_LINELET)
LINEAR_SOLVER= FGMRES
%
% Preconditioner of the Krylov linear solver (ILU, LU_SGS, LINELET, JACOBI)
LINEAR_SOLVER_PREC= ILU
%
% Linear solver ILU preconditioner fill-in level (0 by default)
LINEAR_SOLVER_ILU_FILL_IN= 0
%
% Minimum error of the linear solver for implicit formulations
LINEAR_SOLVER_ERROR= 0.01
%
% Max number of iterations of the linear solver for the implicit formulation
LINEAR_SOLVER_ITER= 10
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

% -------------------------- MULTIGRID PARAMETERS -----------------------------%
%
% Multi-grid levels (0 = no multi-grid)
MGLEVEL= 0

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
%
% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, AUSMPLUSUP, AUSMPLUSUP2, HLLC,
% TURKEL_PREC, MSW, FDS)
CONV_NUM_METHOD_FLOW= ROE
%
% Entropy fix coefficient (0.0 implies no entropy fixing, 1.0 implies scalar
% artificial dissipation)
ENTROPY_FIX_COEFF= 0.1
%
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT)
TIME_DISCRE_FLOW= EULER_IMPLICIT
%

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% -------------------- TURBULENT NUMERICAL METHOD DEFINITION ------------------%
%
% Convective numerical method (SCALAR_UPWIND)
CONV_NUM_METHOD_TURB= SCALAR_UPWIND
%
% Time discretization (EULER_IMPLICIT)
TIME_DISCRE_TURB= EULER_IMPLICIT
%
% Reduction factor of the CFL coefficient in the turbulence problem
CFL_REDUCTION_TURB= 1.0

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
%
% Number of total iterations
ITER= 1000
%
% Min value of the residual (log10 of the residual)
CONV_RESIDUAL_MINVAL= -12
%
% Start convergence criteria at iteration number
CONV_STARTITER= 10

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
%
% Mesh input file
MESH_FILENAME= nozzle.su2
%
% Mesh input file format (SU2, CGNS)
MESH_FORMAT= SU2
%
% Restart flow input file
SOLUTION_FILENAME= solution_flow.dat
%
% Restart adjoint input file
SOLUTION_ADJ_FILENAME= solution_adj.dat
%
% Output file restart adjoint
RESTART_ADJ_FILENAME= restart_adj.dat
%
% Writing solution file frequency
OUTPUT_WRT_FREQ= 1000
%
% Screen output
SCREEN_OUTPUT= (INNER_ITER, RMS_ADJ_DENSITY, RMS_ADJ_ENERGY, RMS_ADJ_TKE, RMS_ADJ_DISSIPATION)
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 15 additions & 0 deletions TestCases/parallel_regression_AD.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ def main():
discadj_incomp_turb_NACA0012_sst.tol = 0.00001
test_list.append(discadj_incomp_turb_NACA0012_sst)

####################################################################
### Disc. Adj. Axisymmetric RANS ###
####################################################################

# Adjoint Axisymmetric RANS
discadj_axisymmetric_rans_nozzle = TestCase('discadj_axisymmetric_rans')
discadj_axisymmetric_rans_nozzle.cfg_dir = "axisymmetric_rans/air_nozzle"
discadj_axisymmetric_rans_nozzle.cfg_file = "air_nozzle_adj.cfg"
discadj_axisymmetric_rans_nozzle.test_iter = 10
discadj_axisymmetric_rans_nozzle.test_vals = [10.000000, -10.391857, -15.524696, -7.715907, -17.350541]
lkusch marked this conversation as resolved.
Show resolved Hide resolved
discadj_axisymmetric_rans_nozzle.su2_exec = "parallel_computation.py -f"
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
discadj_axisymmetric_rans_nozzle.timeout = 1600
discadj_axisymmetric_rans_nozzle.tol = 0.00001
test_list.append(discadj_axisymmetric_rans_nozzle)

#######################################################
### Unsteady Disc. adj. compressible RANS ###
#######################################################
Expand Down