Skip to content

Commit e3c901c

Browse files
overhaul Quick Start tutorial
Source files were added to automate the tutorial simulations and the visualization of results (with ParaView and LaTeX PGFPlots). This way the runs may also be used as a sort of small regression test (for instance, to check whether a build of SU2 is able to work correctly). Moreover, the structure of the tutorial text was reorganized.
1 parent fb55a40 commit e3c901c

13 files changed

+17096
-53
lines changed

_docs_v7/Quick-Start.md

Lines changed: 61 additions & 53 deletions
Large diffs are not rendered by default.

_docs_v7/Quick-Start_source/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+

0 commit comments

Comments
 (0)