Skip to content

Commit 25d54da

Browse files
add files for QuickStart tutorial (#43)
* add files for QuickStart tutorial Auxiliary source files were also included to automate the tutorial simulations and the visualization of results (with ParaView and LaTeX PGFPlots). * drop mesh and main config from QuickStart Those files have been moved back to the SU2 code repository. * strip out comments from QuickStart config files
1 parent 09e5662 commit 25d54da

File tree

6 files changed

+617
-0
lines changed

6 files changed

+617
-0
lines changed

compressible_flow/QuickStart/Makefile

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
## \file Makefile
2+
# \brief Makefile for the QuickStart tutorial
3+
# \author F. Poli
4+
# \version 7.5.1 "Blackbird"
5+
#
6+
# SU2 Project Website: https://su2code.github.io
7+
#
8+
# The SU2 Project is maintained by the SU2 Foundation
9+
# (http://su2foundation.org)
10+
#
11+
# Copyright 2023, SU2 Contributors (cf. AUTHORS.md)
12+
#
13+
# SU2 is free software; you can redistribute it and/or
14+
# modify it under the terms of the GNU Lesser General Public
15+
# License as published by the Free Software Foundation; either
16+
# version 2.1 of the License, or (at your option) any later version.
17+
#
18+
# SU2 is distributed in the hope that it will be useful,
19+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+
# Lesser General Public License for more details.
22+
#
23+
# You should have received a copy of the GNU Lesser General Public
24+
# License along with SU2. If not, see <http://www.gnu.org/licenses/>.
25+
26+
TIME=/usr/bin/time
27+
28+
all: restart_flow.dat NACA0012_coef_pres.pdf NACA0012_pressure_field.png \
29+
adj/restart_adj_cd.dat dadj/restart_adj_cd.dat \
30+
NACA0012_surf_sens.pdf \
31+
NACA0012_coef_pres.png NACA0012_surf_sens.png
32+
33+
restart_flow.dat: inv_NACA0012.cfg mesh_NACA0012_inv.su2
34+
$(TIME) -o su2_cfd_time.out SU2_CFD $< | tee su2_cfd.log
35+
36+
NACA0012_coef_pres.pdf: NACA0012_coef_pres.tex restart_flow.dat surface_flow.csv
37+
texfot -q lualatex $<
38+
39+
NACA0012_pressure_field.png: make_field_shots.py restart_flow.dat flow.vtu
40+
python3 make_field_shots.py
41+
42+
adj/restart_adj_cd.dat: adj/inv_adj_NACA0012.cfg mesh_NACA0012_inv.su2 \
43+
restart_flow.dat
44+
cd adj \
45+
&& ln -sf ../mesh_NACA0012_inv.su2 ./mesh_NACA0012_inv.su2 \
46+
&& ln -sf ../restart_flow.dat ./solution_flow.dat \
47+
&& $(TIME) -o su2_cfd_adj_time.out \
48+
SU2_CFD inv_adj_NACA0012.cfg | tee su2_cfd_adj.log
49+
50+
dadj/restart_adj_cd.dat: dadj/inv_dadj_NACA0012.cfg mesh_NACA0012_inv.su2 \
51+
restart_flow.dat
52+
cd dadj \
53+
&& ln -sf ../mesh_NACA0012_inv.su2 ./mesh_NACA0012_inv.su2 \
54+
&& ln -sf ../restart_flow.dat ./solution_flow.dat \
55+
&& $(TIME) -o su2_cfd_ad_dadj_time.out \
56+
SU2_CFD_AD inv_dadj_NACA0012.cfg | tee su2_cfd_ad_dadj.log
57+
58+
NACA0012_surf_sens.pdf: NACA0012_surf_sens.tex \
59+
adj/restart_adj_cd.dat dadj/restart_adj_cd.dat \
60+
adj/surface_adjoint.csv dadj/surface_adjoint.csv
61+
texfot -q lualatex $<
62+
63+
%.png: %.pdf
64+
convert -density 154x154 $< $@
65+
66+
.PHONY: clean
67+
clean:
68+
-rm -f *.log *.aux *.out *adj/*.log *adj/*.out
69+
-rm -f *adj/solution_flow.dat *adj/mesh_NACA0012_inv.su2
70+
71+
.PHONY: distclean
72+
distclean: clean
73+
-rm -f *.vtu *.csv *.dat *adj/*.csv *adj/*.dat *.png *.pdf
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
\documentclass[tikz,margin=1pt]{standalone}
2+
3+
%% \file NACA0012_coef_pres.tex
4+
% \brief LaTeX code for the C_p plot in the QuickStart tutorial
5+
% \author F. Poli
6+
% \version 7.5.1 "Blackbird"
7+
%
8+
% SU2 Project Website: https://su2code.github.io
9+
%
10+
% The SU2 Project is maintained by the SU2 Foundation
11+
% (http://su2foundation.org)
12+
%
13+
% Copyright 2023, SU2 Contributors (cf. AUTHORS.md)
14+
%
15+
% SU2 is free software; you can redistribute it and/or
16+
% modify it under the terms of the GNU Lesser General Public
17+
% License as published by the Free Software Foundation; either
18+
% version 2.1 of the License, or (at your option) any later version.
19+
%
20+
% SU2 is distributed in the hope that it will be useful,
21+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23+
% Lesser General Public License for more details.
24+
%
25+
% You should have received a copy of the GNU Lesser General Public
26+
% License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27+
28+
\usepackage{pgfplots}
29+
\pgfplotsset{compat=1.17,trig format plots=rad,tick scale binop=\times,
30+
/pgf/number format/sci generic={mantissa sep=\times,exponent={10^{#1}}},
31+
/pgf/number format/1000 sep={\,}}
32+
%\usepgfplotslibrary{groupplots}
33+
%\usepgfplotslibrary{patchplots}
34+
\usepackage{pgfplotstable}
35+
\begin{document}
36+
\begin{tikzpicture}
37+
\pagecolor{white}
38+
\begin{axis}
39+
[
40+
title={Coefficient of pressure for the NACA 0012 airfoil},
41+
width=108mm,
42+
height=88mm,
43+
xlabel={$x/c$},
44+
ylabel={$C_p$},
45+
enlarge x limits=false,
46+
%enlarge y limits=true,
47+
ymin=-1.5,ymax=1.5,
48+
y dir=reverse,
49+
%ymajorgrids=true,
50+
legend cell align=left,
51+
legend pos=south east,
52+
table/col sep=comma,
53+
]
54+
\addplot%+
55+
[
56+
blue!50!black,
57+
thick,
58+
mark=*,
59+
mark size=0.7,
60+
]
61+
table
62+
[
63+
x="x",
64+
y="Pressure_Coefficient",
65+
]
66+
{surface_flow.csv};
67+
\addlegendentry{SU2}
68+
\end{axis}
69+
\end{tikzpicture}
70+
\end{document}
71+
72+
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
\documentclass[tikz,margin=1pt]{standalone}
2+
3+
%% \file NACA0012_surf_sens.tex
4+
% \brief LaTeX code for the sensitivity plot in the QuickStart tutorial
5+
% \author F. Poli
6+
% \version 7.5.1 "Blackbird"
7+
%
8+
% SU2 Project Website: https://su2code.github.io
9+
%
10+
% The SU2 Project is maintained by the SU2 Foundation
11+
% (http://su2foundation.org)
12+
%
13+
% Copyright 2023, SU2 Contributors (cf. AUTHORS.md)
14+
%
15+
% SU2 is free software; you can redistribute it and/or
16+
% modify it under the terms of the GNU Lesser General Public
17+
% License as published by the Free Software Foundation; either
18+
% version 2.1 of the License, or (at your option) any later version.
19+
%
20+
% SU2 is distributed in the hope that it will be useful,
21+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23+
% Lesser General Public License for more details.
24+
%
25+
% You should have received a copy of the GNU Lesser General Public
26+
% License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27+
28+
\usepackage{pgfplots}
29+
\pgfplotsset{compat=1.17,trig format plots=rad,tick scale binop=\times,
30+
/pgf/number format/sci generic={mantissa sep=\times,exponent={10^{#1}}},
31+
/pgf/number format/1000 sep={\,}}
32+
%\usepgfplotslibrary{groupplots}
33+
%\usepgfplotslibrary{patchplots}
34+
\usepackage{pgfplotstable}
35+
\begin{document}
36+
\begin{tikzpicture}
37+
\pagecolor{white}
38+
\begin{axis}
39+
[
40+
title={Surface sensitivities for the NACA 0012 airfoil},
41+
width=108mm,
42+
height=88mm,
43+
xlabel={$x/c$},
44+
ylabel={surface sensitivity},
45+
enlarge x limits=false,
46+
%enlarge y limits=true,
47+
ymin=-2,ymax=2,
48+
%ymajorgrids=true,
49+
legend cell align=left,
50+
legend pos=south west,
51+
table/col sep=comma,
52+
]
53+
\addplot%+
54+
[
55+
blue!50!black,
56+
thick,
57+
mark=*,
58+
mark size=0.7,
59+
]
60+
table
61+
[
62+
x="x",
63+
y="Surface_Sensitivity",
64+
]
65+
{adj/surface_adjoint.csv};
66+
\addlegendentry{SU2 continuous adjoint}
67+
\addplot%+
68+
[
69+
blue!40!white,
70+
thick,
71+
mark=*,
72+
mark size=0.7,
73+
]
74+
table
75+
[
76+
x="x",
77+
y="Surface_Sensitivity",
78+
]
79+
{dadj/surface_adjoint.csv};
80+
\addlegendentry{SU2 discrete adjoint}
81+
\end{axis}
82+
\end{tikzpicture}
83+
\end{document}
84+
85+
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% %
3+
% SU2 configuration file %
4+
% Case description: Transonic inviscid flow around a NACA0012 airfoil %
5+
% Author: Thomas D. Economon %
6+
% Institution: Stanford University %
7+
% Date: 2014.06.11 %
8+
% File Version 7.5.1 "Blackbird" %
9+
% %
10+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11+
12+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
13+
14+
SOLVER= EULER
15+
MATH_PROBLEM= CONTINUOUS_ADJOINT
16+
RESTART_SOL= NO
17+
18+
% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------%
19+
20+
MACH_NUMBER= 0.8
21+
AOA= 1.25
22+
FREESTREAM_PRESSURE= 101325.0
23+
FREESTREAM_TEMPERATURE= 273.15
24+
25+
% -------------- COMPRESSIBLE AND INCOMPRESSIBLE FLUID CONSTANTS --------------%
26+
27+
GAMMA_VALUE= 1.4
28+
GAS_CONSTANT= 287.87
29+
30+
% ---------------------- REFERENCE VALUE DEFINITION ---------------------------%
31+
32+
REF_ORIGIN_MOMENT_X = 0.25
33+
REF_ORIGIN_MOMENT_Y = 0.00
34+
REF_ORIGIN_MOMENT_Z = 0.00
35+
REF_LENGTH= 1.0
36+
REF_AREA= 1.0
37+
REF_DIMENSIONALIZATION= DIMENSIONAL
38+
39+
% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------%
40+
41+
MARKER_EULER= ( airfoil )
42+
MARKER_FAR= ( farfield )
43+
44+
% ------------------------ SURFACES IDENTIFICATION ----------------------------%
45+
46+
MARKER_PLOTTING = ( airfoil )
47+
MARKER_MONITORING = ( airfoil )
48+
MARKER_DESIGNING = ( airfoil )
49+
50+
% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------%
51+
52+
NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES
53+
OBJECTIVE_FUNCTION= DRAG
54+
CFL_NUMBER= 1e3
55+
CFL_ADAPT= NO
56+
CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10 )
57+
ITER= 250
58+
59+
% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
60+
61+
LINEAR_SOLVER= FGMRES
62+
LINEAR_SOLVER_PREC= ILU
63+
LINEAR_SOLVER_ERROR= 1E-10
64+
LINEAR_SOLVER_ITER= 10
65+
66+
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
67+
68+
MGLEVEL= 3
69+
MGCYCLE= W_CYCLE
70+
MG_PRE_SMOOTH= ( 1, 2, 3, 3 )
71+
MG_POST_SMOOTH= ( 0, 0, 0, 0 )
72+
MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 )
73+
MG_DAMP_RESTRICTION= 1.0
74+
MG_DAMP_PROLONGATION= 1.0
75+
76+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
77+
78+
CONV_NUM_METHOD_FLOW= JST
79+
JST_SENSOR_COEFF= ( 0.5, 0.02 )
80+
TIME_DISCRE_FLOW= EULER_IMPLICIT
81+
82+
% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------%
83+
84+
CONV_NUM_METHOD_ADJFLOW= JST
85+
CFL_REDUCTION_ADJFLOW= 0.01
86+
TIME_DISCRE_ADJFLOW= EULER_IMPLICIT
87+
88+
% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------%
89+
90+
DV_KIND= HICKS_HENNE
91+
DV_MARKER= ( airfoil )
92+
DV_PARAM= ( 1, 0.5 )
93+
DV_VALUE= 0.01
94+
95+
% ------------------------ GRID DEFORMATION PARAMETERS ------------------------%
96+
97+
DEFORM_LINEAR_SOLVER_ITER= 500
98+
DEFORM_NONLINEAR_ITER= 1
99+
DEFORM_LINEAR_SOLVER_ERROR= 1E-14
100+
DEFORM_CONSOLE_OUTPUT= YES
101+
DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME
102+
103+
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
104+
105+
CONV_FIELD= RMS_DENSITY
106+
CONV_RESIDUAL_MINVAL= -8
107+
CONV_STARTITER= 10
108+
CONV_CAUCHY_ELEMS= 100
109+
CONV_CAUCHY_EPS= 1E-6
110+
SCREEN_OUTPUT=(INNER_ITER, WALL_TIME, RMS_RES, LIFT, DRAG, CAUCHY_SENS_PRESS, CAUCHY_DRAG RMS_ADJ_DENSITY RMS_ADJ_ENERGY)
111+
112+
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
113+
114+
MESH_FILENAME= mesh_NACA0012_inv.su2
115+
MESH_FORMAT= SU2
116+
MESH_OUT_FILENAME= mesh_out.su2
117+
SOLUTION_FILENAME= solution_flow.dat
118+
SOLUTION_ADJ_FILENAME= solution_adj.dat
119+
TABULAR_FORMAT= CSV
120+
CONV_FILENAME= history
121+
RESTART_FILENAME= restart_flow.dat
122+
RESTART_ADJ_FILENAME= restart_adj.dat
123+
VOLUME_FILENAME= flow
124+
VOLUME_ADJ_FILENAME= adjoint
125+
GRAD_OBJFUNC_FILENAME= of_grad.dat
126+
SURFACE_FILENAME= surface_flow
127+
SURFACE_ADJ_FILENAME= surface_adjoint
128+
OUTPUT_WRT_FREQ= 250
129+
OUTPUT_FILES= (RESTART, SURFACE_CSV)
130+
131+
% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------%
132+
133+
OPT_OBJECTIVE= DRAG * 0.001
134+
OPT_CONSTRAINT= ( LIFT > 0.328188 ) * 0.001; ( MOMENT_Z > 0.034068 ) * 0.001; ( AIRFOIL_THICKNESS > 0.11 ) * 0.001
135+
DEFINITION_DV= ( 30, 1.0 | airfoil | 0, 0.05 ); ( 30, 1.0 | airfoil | 0, 0.10 ); ( 30, 1.0 | airfoil | 0, 0.15 ); ( 30, 1.0 | airfoil | 0, 0.20 ); ( 30, 1.0 | airfoil | 0, 0.25 ); ( 30, 1.0 | airfoil | 0, 0.30 ); ( 30, 1.0 | airfoil | 0, 0.35 ); ( 30, 1.0 | airfoil | 0, 0.40 ); ( 30, 1.0 | airfoil | 0, 0.45 ); ( 30, 1.0 | airfoil | 0, 0.50 ); ( 30, 1.0 | airfoil | 0, 0.55 ); ( 30, 1.0 | airfoil | 0, 0.60 ); ( 30, 1.0 | airfoil | 0, 0.65 ); ( 30, 1.0 | airfoil | 0, 0.70 ); ( 30, 1.0 | airfoil | 0, 0.75 ); ( 30, 1.0 | airfoil | 0, 0.80 ); ( 30, 1.0 | airfoil | 0, 0.85 ); ( 30, 1.0 | airfoil | 0, 0.90 ); ( 30, 1.0 | airfoil | 0, 0.95 ); ( 30, 1.0 | airfoil | 1, 0.05 ); ( 30, 1.0 | airfoil | 1, 0.10 ); ( 30, 1.0 | airfoil | 1, 0.15 ); ( 30, 1.0 | airfoil | 1, 0.20 ); ( 30, 1.0 | airfoil | 1, 0.25 ); ( 30, 1.0 | airfoil | 1, 0.30 ); ( 30, 1.0 | airfoil | 1, 0.35 ); ( 30, 1.0 | airfoil | 1, 0.40 ); ( 30, 1.0 | airfoil | 1, 0.45 ); ( 30, 1.0 | airfoil | 1, 0.50 ); ( 30, 1.0 | airfoil | 1, 0.55 ); ( 30, 1.0 | airfoil | 1, 0.60 ); ( 30, 1.0 | airfoil | 1, 0.65 ); ( 30, 1.0 | airfoil | 1, 0.70 ); ( 30, 1.0 | airfoil | 1, 0.75 ); ( 30, 1.0 | airfoil | 1, 0.80 ); ( 30, 1.0 | airfoil | 1, 0.85 ); ( 30, 1.0 | airfoil | 1, 0.90 ); ( 30, 1.0 | airfoil | 1, 0.95 )

0 commit comments

Comments
 (0)