Skip to content

Commit ca4d7bb

Browse files
Add SU2-FEniCS Perpendicular Flap FSI Tutorial (#91)
* Adding 2D perpendicular flap FSI tutorial with SU2-FEniCS Co-authored-by: Benjamin Rüth <benjamin.rueth@tum.de>
1 parent ebcc5ae commit ca4d7bb

12 files changed

Lines changed: 2371 additions & 0 deletions
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/sh
2+
cd ${0%/*} || exit 1 # Run from this directory
3+
4+
echo "Cleaning..."
5+
6+
# Participant 1: Fluid
7+
Participant1="Fluid"
8+
cd ${Participant1}
9+
# Clean the result and auxiliary files
10+
rm -fv flow_*.vtk
11+
rm -fv history_*.vtk
12+
rm -fv restart_flow_*.dat
13+
rm -fv forces_breakdown.dat
14+
rm -fv surface_flow_*.csv
15+
cd ..
16+
17+
# Remove the log files
18+
rm -fv ${Participant1}.log
19+
rm -fv Output/*.log
20+
21+
# Participant 2: Solid
22+
Participant2="Solid"
23+
cd ${Participant2}
24+
# Clean the case
25+
rm -fv *.log
26+
rm -fv *.vtk
27+
rm -fv *.pvd
28+
rm -fv FSI-S/*
29+
cd ..
30+
# Remove the log files
31+
rm -fv spooles.out
32+
rm -fv ${Participant2}.log
33+
34+
# Remove the preCICE-related log files
35+
echo "Deleting the preCICE log files..."
36+
rm -fv \
37+
precice-*.log \
38+
precice-postProcessingInfo.log \
39+
precice-*-events.json
40+
41+
# Output files for preCICE versions before 1.2:
42+
rm -fv \
43+
iterations-${Participant1}.txt iterations-${Participant2}.txt \
44+
convergence-${Participant1}.txt convergence-${Participant2}.txt \
45+
Events-${Participant1}.log Events-${Participant2}.log \
46+
EventTimings-${Participant1}.log EventTimings-${Participant2}.log
47+
48+
# Remove the preCICE address files
49+
rm -rfv precice-run
50+
rm -fv .*.address
51+
52+
echo "Cleaning complete!"
53+
#------------------------------------------------------------------------------

FSI/flap_perp_2D/SU2-FEniCS/Allrun

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
3+
# This script prepares and runs all the participants in one terminal,
4+
# forwarding the solvers' output to log files.
5+
# Alternatively, you may execute the scripts "runSolid" and "runFluid"
6+
# in separate terminals.
7+
8+
# Run this script with "-parallel" for parallel simulations
9+
10+
# The script "Allclean" cleans-up the result and log files.
11+
# Set up the run parameters:
12+
13+
# 1 for true, 0 for false
14+
parallel=0
15+
if [ "$1" = "-parallel" ]; then
16+
parallel=1
17+
fi
18+
19+
# =============== Participant 1: Fluid ===========================
20+
Participant1="Fluid"
21+
Solver1="SU2_CFD"
22+
nproc=2
23+
24+
# Run and get the process id
25+
if [ $parallel -eq 1 ]; then
26+
echo " Starting the ${Participant1} participant in parallel..."
27+
mpirun -np ${nproc} ${Solver1} Fluid/euler_config_coupled.cfg > ${Participant1}.log 2>&1 &
28+
else
29+
echo " Starting the ${Participant1} participant in serial..."
30+
${Solver1} Fluid/euler_config_coupled.cfg > ${Participant1}.log 2>&1 &
31+
fi
32+
PIDParticipant1=$!
33+
34+
# =============== Participant 2: Solid ===========================
35+
Participant2="Solid"
36+
37+
# Run
38+
echo " Starting the ${Participant2} participant..."
39+
python3 ${Participant2}/perp-flap.py > ${Participant2}.log 2>&1 &
40+
PIDParticipant2=$!
41+
42+
43+
# =============== Wait for all the participants to finish =======
44+
echo "Waiting for the participants to exit..., PIDs: ${PIDParticipant1}, ${PIDParticipant2}"
45+
echo "(you may run 'tail -f ${Participant1}.log' in another terminal to check the progress)"
46+
47+
echo "To interrupt the simulation, press 'c'. Ctrl+C will only send the processes to the background."
48+
while [ -e /proc/${PIDParticipant1} ]; do
49+
read -r -t1 -n1 input
50+
if [ "$input" = "c" ]; then
51+
kill ${PIDParticipant1}
52+
kill ${PIDParticipant2}
53+
false
54+
fi
55+
done
56+
57+
if [ $? -ne 0 ] || [ "$(grep -c -E "error:" ${Participant1}.log)" -ne 0 ] || [ "$(grep -c -E "error:" ${Participant2}.log)" -ne 0 ]; then
58+
echo ""
59+
echo "Something went wrong... See the log files for more."
60+
# Precaution
61+
kill ${PIDParticipant1}
62+
kill ${PIDParticipant2}
63+
else
64+
echo ""
65+
echo "The simulation completed! (check for any errors)"
66+
fi
Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2+
% %
3+
% SU2 configuration file %
4+
% Case description: Coupled FSI simulation of fluid flow over a flap %
5+
% Authors: Kirill Martynov, Dmytro Sashko, Jan Sültemeyer %
6+
% Institution: Technische Universität München %
7+
% Date: 01.11.2017 %
8+
% %
9+
% Modified for SU2-FEniCS tutorial by Ishaan Desai %
10+
% Date: 28.08.2020 %
11+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12+
13+
% ------------- PRECICE PROBLEM DEFINITION ------------%
14+
15+
PRECICE_USAGE= YES
16+
%
17+
PRECICE_CONFIG_FILENAME= ./precice-config.xml
18+
%
19+
PRECICE_WETSURFACE_MARKER_NAME= wetSurface
20+
%
21+
PRECICE_NUMBER_OF_WETSURFACES= 1
22+
23+
% ------------- DIRECT, ADJOINT, AND LINEARIZED PROBLEM DEFINITION ------------%
24+
25+
% Physical governing equations (EULER, NAVIER_STOKES, NS_PLASMA)
26+
PHYSICAL_PROBLEM= EULER
27+
%
28+
% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT)
29+
MATH_PROBLEM= DIRECT
30+
%
31+
% Restart solution (NO, YES)
32+
RESTART_SOL= YES
33+
34+
% -------------------- COMPRESSIBLE FREE-STREAM DEFINITION --------------------%
35+
36+
% Mach number (non-dimensional, based on the free-stream values)
37+
MACH_NUMBER= 0.01
38+
%
39+
% Angle of attack (degrees, only for compressible flows)
40+
AOA= 0.0
41+
%
42+
% Side-slip angle (degrees, only for compressible flows)
43+
SIDESLIP_ANGLE= 0.0
44+
%
45+
% Free-stream pressure (101325.0 N/m^2 by default)
46+
FREESTREAM_PRESSURE= 101300.0
47+
%
48+
% Free-stream temperature (288.15 K by default)
49+
FREESTREAM_TEMPERATURE= 288.0
50+
51+
% ------------------------- UNSTEADY SIMULATION -------------------------------%
52+
53+
% Unsteady simulation (NO, TIME_STEPPING, DUAL_TIME_STEPPING-1ST_ORDER,
54+
% DUAL_TIME_STEPPING-2ND_ORDER, TIME_SPECTRAL)
55+
UNSTEADY_SIMULATION= DUAL_TIME_STEPPING-1ST_ORDER
56+
%
57+
% Time Step for dual time stepping simulations (s)
58+
UNST_TIMESTEP= 0.01
59+
%
60+
% Total Physical Time for dual time stepping simulations (s)
61+
UNST_TIME= 6.0
62+
%
63+
% Number of internal iterations (dual time method)
64+
UNST_INT_ITER= 200
65+
%
66+
% Iteration number to begin unsteady restarts
67+
UNST_RESTART_ITER= 1
68+
69+
% ----------------------- DYNAMIC MESH DEFINITION -----------------------------%
70+
71+
% Dynamic mesh simulation (NO, YES)
72+
GRID_MOVEMENT= YES
73+
%
74+
% Type of dynamic mesh (NONE, RIGID_MOTION, DEFORMING, ROTATING_FRAME,
75+
% MOVING_WALL, STEADY_TRANSLATION, FLUID_STRUCTURE,
76+
% AEROELASTIC, ELASTICITY, EXTERNAL,
77+
% AEROELASTIC_RIGID_MOTION, GUST, PRECICE_MOVEMENT)
78+
GRID_MOVEMENT_KIND= PRECICE_MOVEMENT
79+
%
80+
% Moving wall boundary marker(s) (NONE = no marker, ignored for RIGID_MOTION)
81+
MARKER_MOVING= ( wetSurface0 )
82+
83+
% -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
84+
85+
% Euler wall boundary marker(s) (NONE = no marker)
86+
MARKER_EULER= ( upper_wall, lower_wall, wetSurface0 )
87+
%
88+
% Inlet boundary marker(s) (NONE = no marker)
89+
% Format: ( inlet marker, total temperature, total pressure, flow_direction_x,
90+
% flow_direction_y, flow_direction_z ... ) where flow_direction is a unit vector.
91+
MARKER_INLET= ( inlet, 288.6, 101400.0, 1.0, 0.0, 0.0 )
92+
%
93+
% Outlet boundary marker(s) (NONE = no marker)
94+
% Format: ( outlet marker, back pressure (static), ... )
95+
MARKER_OUTLET= ( outlet, 101300.0 )
96+
97+
% ------------- COMMON PARAMETERS DEFINING THE NUMERICAL METHOD ---------------%
98+
99+
% Numerical method for spatial gradients (GREEN_GAUSS, WEIGHTED_LEAST_SQUARES)
100+
NUM_METHOD_GRAD= GREEN_GAUSS
101+
%
102+
% Courant-Friedrichs-Lewy condition of the finest grid
103+
CFL_NUMBER= 2.0
104+
%
105+
% Adaptive CFL number (NO, YES)
106+
CFL_ADAPT= NO
107+
%
108+
% Parameters of the adaptive CFL number (factor down, factor up, CFL min value,
109+
% CFL max value )
110+
CFL_ADAPT_PARAM= ( 1.5, 0.5, 1.0, 100.0 )
111+
%
112+
% Runge-Kutta alpha coefficients
113+
RK_ALPHA_COEFF= ( 0.66667, 0.66667, 1.000000 )
114+
%
115+
% Number of total iterations
116+
EXT_ITER= 999999
117+
118+
% ------------------------ LINEAR SOLVER DEFINITION ---------------------------%
119+
120+
% Linear solver for implicit formulations (BCGSTAB, FGMRES)
121+
LINEAR_SOLVER= FGMRES
122+
%
123+
% Preconditioner of the Krylov linear solver (JACOBI, LINELET, LU_SGS)
124+
LINEAR_SOLVER_PREC= LU_SGS
125+
%
126+
% Minimum error of the linear solver for implicit formulations
127+
LINEAR_SOLVER_ERROR= 1E-4
128+
%
129+
% Max number of iterations of the linear solver for the implicit formulation
130+
LINEAR_SOLVER_ITER= 20
131+
132+
% -------------------------- MULTIGRID PARAMETERS -----------------------------%
133+
134+
% Multi-Grid Levels (0 = no multi-grid)
135+
MGLEVEL= 3
136+
%
137+
% Multi-grid cycle (V_CYCLE, W_CYCLE, FULLMG_CYCLE)
138+
MGCYCLE= V_CYCLE
139+
%
140+
% Multi-grid pre-smoothing level
141+
MG_PRE_SMOOTH= ( 1, 2, 3, 3 )
142+
%
143+
% Multi-grid post-smoothing level
144+
MG_POST_SMOOTH= ( 0, 0, 0, 0 )
145+
%
146+
% Jacobi implicit smoothing of the correction
147+
MG_CORRECTION_SMOOTH= ( 0, 0, 0, 0 )
148+
%
149+
% Damping factor for the residual restriction
150+
MG_DAMP_RESTRICTION= 0.9
151+
%
152+
% Damping factor for the correction prolongation
153+
MG_DAMP_PROLONGATION= 0.9
154+
155+
% -------------------- FLOW NUMERICAL METHOD DEFINITION -----------------------%
156+
157+
% Convective numerical method (JST, LAX-FRIEDRICH, CUSP, ROE, AUSM, HLLC,
158+
% TURKEL_PREC, MSW)
159+
CONV_NUM_METHOD_FLOW= JST
160+
%
161+
% Monotonic Upwind Scheme for Conservation Laws (TVD) in the flow equations.
162+
% Required for 2nd order upwind schemes (NO, YES)
163+
MUSCL_FLOW= YES
164+
%
165+
% Slope limiter (NONE, VENKATAKRISHNAN, VENKATAKRISHNAN_WANG,
166+
% BARTH_JESPERSEN, VAN_ALBADA_EDGE)
167+
SLOPE_LIMITER_FLOW= VENKATAKRISHNAN
168+
%
169+
% Coefficient for the Venkats limiter (upwind scheme). A larger values decrease
170+
% the extent of limiting, values approaching zero cause
171+
% lower-order approximation to the solution (0.05 by default)
172+
VENKAT_LIMITER_COEFF= 0.05
173+
%
174+
% 2nd and 4th order artificial dissipation coefficients for
175+
% the JST method ( 0.5, 0.02 by default )
176+
JST_SENSOR_COEFF= ( 0.5, 0.02 )
177+
%
178+
% Time discretization (RUNGE-KUTTA_EXPLICIT, EULER_IMPLICIT, EULER_EXPLICIT)
179+
TIME_DISCRE_FLOW= EULER_IMPLICIT
180+
181+
% --------------------------- CONVERGENCE PARAMETERS --------------------------%
182+
183+
% Convergence criteria (CAUCHY, RESIDUAL)
184+
%
185+
CONV_CRITERIA= RESIDUAL
186+
%
187+
% Residual reduction (order of magnitude with respect to the initial value)
188+
RESIDUAL_REDUCTION= 1
189+
%
190+
% Min value of the residual (log10 of the residual)
191+
RESIDUAL_MINVAL= -3.5
192+
%
193+
% Start convergence criteria at iteration number
194+
STARTCONV_ITER= 10
195+
196+
% ------------------------- INPUT/OUTPUT INFORMATION --------------------------%
197+
198+
% Write residuals
199+
WRT_RESIDUALS= YES
200+
%
201+
% Mesh input file
202+
MESH_FILENAME= Fluid/fluidMesh.su2
203+
%
204+
% Mesh input file format (SU2, CGNS, NETCDF_ASCII)
205+
MESH_FORMAT= SU2
206+
%
207+
% Restart flow input file
208+
SOLUTION_FLOW_FILENAME= Fluid/initial_flow.dat
209+
%
210+
% Output file format (PARAVIEW, TECPLOT, STL)
211+
OUTPUT_FORMAT= PARAVIEW
212+
%
213+
% Output file with the forces breakdown
214+
BREAKDOWN_FILENAME= Fluid/forces_breakdown.dat
215+
%
216+
% Output file restart flow
217+
RESTART_FLOW_FILENAME= Fluid/restart_flow.dat
218+
%
219+
% Output file convergence history (w/o extension)
220+
CONV_FILENAME= Fluid/history
221+
%
222+
% Write binary restart files (YES, NO)
223+
WRT_BINARY_RESTART= NO
224+
%
225+
% Read binary restart files (YES, NO)
226+
READ_BINARY_RESTART= NO
227+
%
228+
% Output file flow (w/o extension) variables
229+
VOLUME_FLOW_FILENAME= Fluid/flow
230+
%
231+
% Output file surface flow coefficient (w/o extension)
232+
SURFACE_FLOW_FILENAME= Fluid/surface_flow
233+
%
234+
% Write surface solution files
235+
WRT_SRF_SOL= NO
236+
%
237+
% Writing solution file frequency
238+
WRT_SOL_FREQ= 1
239+
%
240+
% Writing solution file frequency for physical time steps (dual time)
241+
WRT_SOL_FREQ_DUALTIME= 1
242+
%
243+
% Writing convergence history frequency
244+
WRT_CON_FREQ= 1
245+
%
246+
% Writing convergence history frequency
247+
WRT_CON_FREQ_DUALTIME= 1
248+
249+
% ------------------------ GRID DEFORMATION PARAMETERS ------------------------%
250+
%
251+
% Linear solver or smoother for implicit formulations (FGMRES, RESTARTED_FGMRES, BCGSTAB)
252+
DEFORM_LINEAR_SOLVER= FGMRES
253+
%
254+
% Preconditioner of the Krylov linear solver (ILU, LU_SGS, JACOBI)
255+
DEFORM_LINEAR_SOLVER_PREC= LU_SGS
256+
%
257+
% Number of smoothing iterations for mesh deformation
258+
DEFORM_LINEAR_ITER= 50
259+
%
260+
% Number of nonlinear deformation iterations (surface deformation increments)
261+
DEFORM_NONLINEAR_ITER= 1
262+
%
263+
% Print the residuals during mesh deformation to the console (YES, NO)
264+
%DEFORM_CONSOLE_OUTPUT= NO
265+
%
266+
% Factor to multiply smallest cell volume for deform tolerance (0.001 default)
267+
DEFORM_TOL_FACTOR = 0.1
268+
%
269+
% Type of element stiffness imposed for FEA mesh deformation (INVERSE_VOLUME,
270+
% WALL_DISTANCE, CONSTANT_STIFFNESS)
271+
DEFORM_STIFFNESS_TYPE= INVERSE_VOLUME
272+
%
273+
% Visualize the deformation (NO, YES)
274+
%VISUALIZE_DEFORMATION= YES

0 commit comments

Comments
 (0)