diff --git a/compressible_flow/QuickStart/Makefile b/compressible_flow/QuickStart/Makefile new file mode 100644 index 0000000..3f3d1b5 --- /dev/null +++ b/compressible_flow/QuickStart/Makefile @@ -0,0 +1,73 @@ +## \file Makefile +# \brief Makefile for the QuickStart tutorial +# \author F. Poli +# \version 7.5.1 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +TIME=/usr/bin/time + +all: restart_flow.dat NACA0012_coef_pres.pdf NACA0012_pressure_field.png \ + adj/restart_adj_cd.dat dadj/restart_adj_cd.dat \ + NACA0012_surf_sens.pdf \ + NACA0012_coef_pres.png NACA0012_surf_sens.png + +restart_flow.dat: inv_NACA0012.cfg mesh_NACA0012_inv.su2 + $(TIME) -o su2_cfd_time.out SU2_CFD $< | tee su2_cfd.log + +NACA0012_coef_pres.pdf: NACA0012_coef_pres.tex restart_flow.dat surface_flow.csv + texfot -q lualatex $< + +NACA0012_pressure_field.png: make_field_shots.py restart_flow.dat flow.vtu + python3 make_field_shots.py + +adj/restart_adj_cd.dat: adj/inv_adj_NACA0012.cfg mesh_NACA0012_inv.su2 \ + restart_flow.dat + cd adj \ + && ln -sf ../mesh_NACA0012_inv.su2 ./mesh_NACA0012_inv.su2 \ + && ln -sf ../restart_flow.dat ./solution_flow.dat \ + && $(TIME) -o su2_cfd_adj_time.out \ + SU2_CFD inv_adj_NACA0012.cfg | tee su2_cfd_adj.log + +dadj/restart_adj_cd.dat: dadj/inv_dadj_NACA0012.cfg mesh_NACA0012_inv.su2 \ + restart_flow.dat + cd dadj \ + && ln -sf ../mesh_NACA0012_inv.su2 ./mesh_NACA0012_inv.su2 \ + && ln -sf ../restart_flow.dat ./solution_flow.dat \ + && $(TIME) -o su2_cfd_ad_dadj_time.out \ + SU2_CFD_AD inv_dadj_NACA0012.cfg | tee su2_cfd_ad_dadj.log + +NACA0012_surf_sens.pdf: NACA0012_surf_sens.tex \ + adj/restart_adj_cd.dat dadj/restart_adj_cd.dat \ + adj/surface_adjoint.csv dadj/surface_adjoint.csv + texfot -q lualatex $< + +%.png: %.pdf + convert -density 154x154 $< $@ + +.PHONY: clean +clean: + -rm -f *.log *.aux *.out *adj/*.log *adj/*.out + -rm -f *adj/solution_flow.dat *adj/mesh_NACA0012_inv.su2 + +.PHONY: distclean +distclean: clean + -rm -f *.vtu *.csv *.dat *adj/*.csv *adj/*.dat *.png *.pdf diff --git a/compressible_flow/QuickStart/NACA0012_coef_pres.tex b/compressible_flow/QuickStart/NACA0012_coef_pres.tex new file mode 100644 index 0000000..c0695a4 --- /dev/null +++ b/compressible_flow/QuickStart/NACA0012_coef_pres.tex @@ -0,0 +1,72 @@ +\documentclass[tikz,margin=1pt]{standalone} + +%% \file NACA0012_coef_pres.tex +% \brief LaTeX code for the C_p plot in the QuickStart tutorial +% \author F. Poli +% \version 7.5.1 "Blackbird" +% +% SU2 Project Website: https://su2code.github.io +% +% The SU2 Project is maintained by the SU2 Foundation +% (http://su2foundation.org) +% +% Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +% +% SU2 is free software; you can redistribute it and/or +% modify it under the terms of the GNU Lesser General Public +% License as published by the Free Software Foundation; either +% version 2.1 of the License, or (at your option) any later version. +% +% SU2 is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with SU2. If not, see . + +\usepackage{pgfplots} +\pgfplotsset{compat=1.17,trig format plots=rad,tick scale binop=\times, + /pgf/number format/sci generic={mantissa sep=\times,exponent={10^{#1}}}, + /pgf/number format/1000 sep={\,}} +%\usepgfplotslibrary{groupplots} +%\usepgfplotslibrary{patchplots} +\usepackage{pgfplotstable} +\begin{document} + \begin{tikzpicture} + \pagecolor{white} + \begin{axis} + [ + title={Coefficient of pressure for the NACA 0012 airfoil}, + width=108mm, + height=88mm, + xlabel={$x/c$}, + ylabel={$C_p$}, + enlarge x limits=false, + %enlarge y limits=true, + ymin=-1.5,ymax=1.5, + y dir=reverse, + %ymajorgrids=true, + legend cell align=left, + legend pos=south east, + table/col sep=comma, + ] + \addplot%+ + [ + blue!50!black, + thick, + mark=*, + mark size=0.7, + ] + table + [ + x="x", + y="Pressure_Coefficient", + ] + {surface_flow.csv}; + \addlegendentry{SU2} + \end{axis} + \end{tikzpicture} +\end{document} + + diff --git a/compressible_flow/QuickStart/NACA0012_surf_sens.tex b/compressible_flow/QuickStart/NACA0012_surf_sens.tex new file mode 100644 index 0000000..425e3fd --- /dev/null +++ b/compressible_flow/QuickStart/NACA0012_surf_sens.tex @@ -0,0 +1,85 @@ +\documentclass[tikz,margin=1pt]{standalone} + +%% \file NACA0012_surf_sens.tex +% \brief LaTeX code for the sensitivity plot in the QuickStart tutorial +% \author F. Poli +% \version 7.5.1 "Blackbird" +% +% SU2 Project Website: https://su2code.github.io +% +% The SU2 Project is maintained by the SU2 Foundation +% (http://su2foundation.org) +% +% Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +% +% SU2 is free software; you can redistribute it and/or +% modify it under the terms of the GNU Lesser General Public +% License as published by the Free Software Foundation; either +% version 2.1 of the License, or (at your option) any later version. +% +% SU2 is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% Lesser General Public License for more details. +% +% You should have received a copy of the GNU Lesser General Public +% License along with SU2. If not, see . + +\usepackage{pgfplots} +\pgfplotsset{compat=1.17,trig format plots=rad,tick scale binop=\times, + /pgf/number format/sci generic={mantissa sep=\times,exponent={10^{#1}}}, + /pgf/number format/1000 sep={\,}} +%\usepgfplotslibrary{groupplots} +%\usepgfplotslibrary{patchplots} +\usepackage{pgfplotstable} +\begin{document} + \begin{tikzpicture} + \pagecolor{white} + \begin{axis} + [ + title={Surface sensitivities for the NACA 0012 airfoil}, + width=108mm, + height=88mm, + xlabel={$x/c$}, + ylabel={surface sensitivity}, + enlarge x limits=false, + %enlarge y limits=true, + ymin=-2,ymax=2, + %ymajorgrids=true, + legend cell align=left, + legend pos=south west, + table/col sep=comma, + ] + \addplot%+ + [ + blue!50!black, + thick, + mark=*, + mark size=0.7, + ] + table + [ + x="x", + y="Surface_Sensitivity", + ] + {adj/surface_adjoint.csv}; + \addlegendentry{SU2 continuous adjoint} + \addplot%+ + [ + blue!40!white, + thick, + mark=*, + mark size=0.7, + ] + table + [ + x="x", + y="Surface_Sensitivity", + ] + {dadj/surface_adjoint.csv}; + \addlegendentry{SU2 discrete adjoint} + \end{axis} + \end{tikzpicture} +\end{document} + + diff --git a/compressible_flow/QuickStart/adj/inv_adj_NACA0012.cfg b/compressible_flow/QuickStart/adj/inv_adj_NACA0012.cfg new file mode 100644 index 0000000..575236a --- /dev/null +++ b/compressible_flow/QuickStart/adj/inv_adj_NACA0012.cfg @@ -0,0 +1,135 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic inviscid flow around a NACA0012 airfoil % +% Author: Thomas D. Economon % +% Institution: Stanford University % +% Date: 2014.06.11 % +% File Version 7.5.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% + +SOLVER= EULER +MATH_PROBLEM= CONTINUOUS_ADJOINT +RESTART_SOL= NO + +% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------% + +MACH_NUMBER= 0.8 +AOA= 1.25 +FREESTREAM_PRESSURE= 101325.0 +FREESTREAM_TEMPERATURE= 273.15 + +% -------------- COMPRESSIBLE AND INCOMPRESSIBLE FLUID CONSTANTS --------------% + +GAMMA_VALUE= 1.4 +GAS_CONSTANT= 287.87 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% + +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 1.0 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% + +MARKER_EULER= ( airfoil ) +MARKER_FAR= ( farfield ) + +% ------------------------ SURFACES IDENTIFICATION ----------------------------% + +MARKER_PLOTTING = ( airfoil ) +MARKER_MONITORING = ( airfoil ) +MARKER_DESIGNING = ( airfoil ) + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% + +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +OBJECTIVE_FUNCTION= DRAG +CFL_NUMBER= 1e3 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10 ) +ITER= 250 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% + +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-10 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% + +MGLEVEL= 3 +MGCYCLE= W_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_DAMP_RESTRICTION= 1.0 +MG_DAMP_PROLONGATION= 1.0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% + +CONV_NUM_METHOD_FLOW= JST +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% + +CONV_NUM_METHOD_ADJFLOW= JST +CFL_REDUCTION_ADJFLOW= 0.01 +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT + +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% + +DV_KIND= HICKS_HENNE +DV_MARKER= ( airfoil ) +DV_PARAM= ( 1, 0.5 ) +DV_VALUE= 0.01 + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% + +DEFORM_LINEAR_SOLVER_ITER= 500 +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% + +CONV_FIELD= RMS_DENSITY +CONV_RESIDUAL_MINVAL= -8 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 +SCREEN_OUTPUT=(INNER_ITER, WALL_TIME, RMS_RES, LIFT, DRAG, CAUCHY_SENS_PRESS, CAUCHY_DRAG RMS_ADJ_DENSITY RMS_ADJ_ENERGY) + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% + +MESH_FILENAME= mesh_NACA0012_inv.su2 +MESH_FORMAT= SU2 +MESH_OUT_FILENAME= mesh_out.su2 +SOLUTION_FILENAME= solution_flow.dat +SOLUTION_ADJ_FILENAME= solution_adj.dat +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow.dat +RESTART_ADJ_FILENAME= restart_adj.dat +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +GRAD_OBJFUNC_FILENAME= of_grad.dat +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_WRT_FREQ= 250 +OUTPUT_FILES= (RESTART, SURFACE_CSV) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% + +OPT_OBJECTIVE= DRAG * 0.001 +OPT_CONSTRAINT= ( LIFT > 0.328188 ) * 0.001; ( MOMENT_Z > 0.034068 ) * 0.001; ( AIRFOIL_THICKNESS > 0.11 ) * 0.001 +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 ) diff --git a/compressible_flow/QuickStart/dadj/inv_dadj_NACA0012.cfg b/compressible_flow/QuickStart/dadj/inv_dadj_NACA0012.cfg new file mode 100644 index 0000000..f0f3db2 --- /dev/null +++ b/compressible_flow/QuickStart/dadj/inv_dadj_NACA0012.cfg @@ -0,0 +1,135 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% SU2 configuration file % +% Case description: Transonic inviscid flow around a NACA0012 airfoil % +% Author: Thomas D. Economon % +% Institution: Stanford University % +% Date: 2014.06.11 % +% File Version 7.5.1 "Blackbird" % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------% + +SOLVER= EULER +MATH_PROBLEM= DISCRETE_ADJOINT +RESTART_SOL= NO + +% ----------- COMPRESSIBLE AND INCOMPRESSIBLE FREE-STREAM DEFINITION ----------% + +MACH_NUMBER= 0.8 +AOA= 1.25 +FREESTREAM_PRESSURE= 101325.0 +FREESTREAM_TEMPERATURE= 273.15 + +% -------------- COMPRESSIBLE AND INCOMPRESSIBLE FLUID CONSTANTS --------------% + +GAMMA_VALUE= 1.4 +GAS_CONSTANT= 287.87 + +% ---------------------- REFERENCE VALUE DEFINITION ---------------------------% + +REF_ORIGIN_MOMENT_X = 0.25 +REF_ORIGIN_MOMENT_Y = 0.00 +REF_ORIGIN_MOMENT_Z = 0.00 +REF_LENGTH= 1.0 +REF_AREA= 1.0 +REF_DIMENSIONALIZATION= DIMENSIONAL + +% ----------------------- BOUNDARY CONDITION DEFINITION -----------------------% + +MARKER_EULER= ( airfoil ) +MARKER_FAR= ( farfield ) + +% ------------------------ SURFACES IDENTIFICATION ----------------------------% + +MARKER_PLOTTING = ( airfoil ) +MARKER_MONITORING = ( airfoil ) +MARKER_DESIGNING = ( airfoil ) + +% ------------- COMMON PARAMETERS TO DEFINE THE NUMERICAL METHOD --------------% + +NUM_METHOD_GRAD= WEIGHTED_LEAST_SQUARES +OBJECTIVE_FUNCTION= DRAG +CFL_NUMBER= 1e3 +CFL_ADAPT= NO +CFL_ADAPT_PARAM= ( 0.1, 2.0, 10.0, 1e10 ) +ITER= 250 + +% ------------------------ LINEAR SOLVER DEFINITION ---------------------------% + +LINEAR_SOLVER= FGMRES +LINEAR_SOLVER_PREC= ILU +LINEAR_SOLVER_ERROR= 1E-10 +LINEAR_SOLVER_ITER= 10 + +% -------------------------- MULTIGRID PARAMETERS -----------------------------% + +MGLEVEL= 3 +MGCYCLE= W_CYCLE +MG_PRE_SMOOTH= ( 1, 2, 3, 3 ) +MG_POST_SMOOTH= ( 0, 0, 0, 0 ) +MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 ) +MG_DAMP_RESTRICTION= 1.0 +MG_DAMP_PROLONGATION= 1.0 + +% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------% + +CONV_NUM_METHOD_FLOW= JST +JST_SENSOR_COEFF= ( 0.5, 0.02 ) +TIME_DISCRE_FLOW= EULER_IMPLICIT + +% ---------------- ADJOINT-FLOW NUMERICAL METHOD DEFINITION -------------------% + +CONV_NUM_METHOD_ADJFLOW= JST +CFL_REDUCTION_ADJFLOW= 0.01 +TIME_DISCRE_ADJFLOW= EULER_IMPLICIT + +% ----------------------- DESIGN VARIABLE PARAMETERS --------------------------% + +DV_KIND= HICKS_HENNE +DV_MARKER= ( airfoil ) +DV_PARAM= ( 1, 0.5 ) +DV_VALUE= 0.01 + +% ------------------------ GRID DEFORMATION PARAMETERS ------------------------% + +DEFORM_LINEAR_SOLVER_ITER= 500 +DEFORM_NONLINEAR_ITER= 1 +DEFORM_LINEAR_SOLVER_ERROR= 1E-14 +DEFORM_CONSOLE_OUTPUT= YES +DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME + +% --------------------------- CONVERGENCE PARAMETERS --------------------------% + +CONV_FIELD= RMS_DENSITY +CONV_RESIDUAL_MINVAL= -8 +CONV_STARTITER= 10 +CONV_CAUCHY_ELEMS= 100 +CONV_CAUCHY_EPS= 1E-6 +SCREEN_OUTPUT=(INNER_ITER, WALL_TIME, RMS_RES, LIFT, DRAG, CAUCHY_SENS_PRESS, CAUCHY_DRAG RMS_ADJ_DENSITY RMS_ADJ_ENERGY) + +% ------------------------- INPUT/OUTPUT INFORMATION --------------------------% + +MESH_FILENAME= mesh_NACA0012_inv.su2 +MESH_FORMAT= SU2 +MESH_OUT_FILENAME= mesh_out.su2 +SOLUTION_FILENAME= solution_flow.dat +SOLUTION_ADJ_FILENAME= solution_adj.dat +TABULAR_FORMAT= CSV +CONV_FILENAME= history +RESTART_FILENAME= restart_flow.dat +RESTART_ADJ_FILENAME= restart_adj.dat +VOLUME_FILENAME= flow +VOLUME_ADJ_FILENAME= adjoint +GRAD_OBJFUNC_FILENAME= of_grad.dat +SURFACE_FILENAME= surface_flow +SURFACE_ADJ_FILENAME= surface_adjoint +OUTPUT_WRT_FREQ= 250 +OUTPUT_FILES= (RESTART, SURFACE_CSV) + +% --------------------- OPTIMAL SHAPE DESIGN DEFINITION -----------------------% + +OPT_OBJECTIVE= DRAG * 0.001 +OPT_CONSTRAINT= ( LIFT > 0.328188 ) * 0.001; ( MOMENT_Z > 0.034068 ) * 0.001; ( AIRFOIL_THICKNESS > 0.11 ) * 0.001 +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 ) diff --git a/compressible_flow/QuickStart/make_field_shots.py b/compressible_flow/QuickStart/make_field_shots.py new file mode 100755 index 0000000..52c02dd --- /dev/null +++ b/compressible_flow/QuickStart/make_field_shots.py @@ -0,0 +1,117 @@ +#!/usr/bin/python3 + +## \file make_field_shots.py +# \brief Paraview script for the visualizations in the QuickStart tutorial +# \author F. Poli +# \version 7.5.1 "Blackbird" +# +# SU2 Project Website: https://su2code.github.io +# +# The SU2 Project is maintained by the SU2 Foundation +# (http://su2foundation.org) +# +# Copyright 2023, SU2 Contributors (cf. AUTHORS.md) +# +# SU2 is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# SU2 is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with SU2. If not, see . + +import paraview.simple as pvs + +# load data file +flowdata = pvs.OpenDataFile('flow.vtu') + +# create rendering view +renderview = pvs.GetActiveViewOrCreate('RenderView') +renderview.SetPropertyWithName('UseFXAA', 0) +pvs.SetActiveView(renderview) + +# set 2D mode and camera +renderview.InteractionMode = '2D' +renderview.CameraFocalPoint = [0.4, 0.16, 0.0] +renderview.CameraParallelScale = 1.0 + +# set layout +layout = pvs.GetLayout() +layout.SetSize(820, 620) + +# set quantity to be shown +flowdisplay = pvs.Show() +pvs.ColorBy(flowdisplay, ('POINTS', 'Pressure')) + +# set range and color preset for quantity +pressurelut = pvs.GetColorTransferFunction('Pressure') +pressurelut.RescaleTransferFunction(50000.0, 155000.0) +pressurelut.NumberOfTableValues = 21 +pressurelut.ApplyPreset('Jet', True) + +# enable colorbar legend +flowdisplay.SetScalarBarVisibility(renderview, True) + +# customize colorbar legend +pressurelutbar = pvs.GetScalarBar(pressurelut, renderview) +pressurelutbar.WindowLocation = 'Upper Right Corner' +pressurelutbar.Title = 'Pressure [Pa]' +pressurelutbar.AutomaticLabelFormat = 0 +pressurelutbar.LabelFormat = '%-#.1f' +pressurelutbar.RangeLabelFormat = '%-#.1f' + +# create contours +pressurecontour = pvs.Contour(registrationName='pContour', Input=flowdata) +pressurecontour.ContourBy = ['POINTS', 'Pressure'] +pressurecontour.Isosurfaces = \ + [ 50e3, 55e3, 60e3, 65e3, 70e3, 75e3, 80e3, 85e3, 90e3, 95e3, 100e3, + 105e3, 110e3, 115e3, 120e3, 125e3, 130e3, 135e3, 140e3, 145e3, 150e3, 155e3] +pcontourdisplay = pvs.Show(pressurecontour, renderview, + 'GeometryRepresentation') + +# save screenshot +pvs.SaveScreenshot('NACA0012_pressure_field.png', renderview, + ImageResolution=[665, 500]) + +# hide what we no longer need +pvs.Hide(pressurecontour) +flowdisplay.SetScalarBarVisibility(renderview, False) + +# set quantity to be shown +pvs.ColorBy(flowdisplay, ('POINTS', 'Mach')) + +# set range and color preset for quantity +machlut = pvs.GetColorTransferFunction('Mach') +machlut.RescaleTransferFunction(0.0, 2.0) +machlut.NumberOfTableValues = 20 +machlut.ApplyPreset('Blue Orange (divergent)', True) + +# enable colorbar legend +flowdisplay.SetScalarBarVisibility(renderview, True) + +# customize colorbar legend +machlutbar = pvs.GetScalarBar(machlut, renderview) +machlutbar.WindowLocation = 'Upper Right Corner' +machlutbar.Title = 'Mach number' +machlutbar.AutomaticLabelFormat = 0 +machlutbar.LabelFormat = '%-#.1f' +machlutbar.RangeLabelFormat = '%-#.1f' + +# create contours +machcontour = pvs.Contour(registrationName='mContour', Input=flowdata) +machcontour.ContourBy = ['POINTS', 'Mach'] +machcontour.Isosurfaces = \ + [ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, + 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0 ] +mcontourdisplay = pvs.Show(machcontour, renderview, + 'GeometryRepresentation') + +# save screenshot +pvs.SaveScreenshot('NACA0012_mach_field.png', renderview, + ImageResolution=[665, 500]) +