Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions FSI/flap_perp/SU2-CalculiX/Allclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory

echo "Cleaning..."

# Participant 1: Fluid
Participant1="Fluid"
cd ${Participant1}
# Clean the result and auxiliary files
rm -fv flow_*.vtk
rm -fv history_*.vtk
rm -fv restart_flow_*.dat
rm -fv forces_breakdown.dat
rm -fv surface_flow_*.csv
cd ..

# Remove the log files
rm -fv ${Participant1}.log

# Participant 2: Solid
Participant2="Solid"
cd ${Participant2}
# Clean the case
rm -fv *.log
rm -fv flap.cvg
rm -fv flap.dat
rm -fv flap.frd
rm -fv flap.sta
rm -fv flap.12d
cd ..
# Remove the log files
rm -fv spooles.out
rm -fv ${Participant2}.log

# Remove the preCICE-related log files
echo "Deleting the preCICE log files..."
rm -fv \
precice-*.log \
precice-postProcessingInfo.log \
precice-*-events.json

# Output files for preCICE versions before 1.2:
rm -fv \
iterations-${Participant1}.txt iterations-${Participant2}.txt \
convergence-${Participant1}.txt convergence-${Participant2}.txt \
Events-${Participant1}.log Events-${Participant2}.log \
EventTimings-${Participant1}.log EventTimings-${Participant2}.log

# Remove the preCICE address files
rm -rfv precice-run
rm -fv .*.address

echo "Cleaning complete!"
#------------------------------------------------------------------------------
77 changes: 77 additions & 0 deletions FSI/flap_perp/SU2-CalculiX/Allrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

# This script prepares and runs all the participants in one terminal,
# forwarding the solvers' output to log files.
# Alternatively, you may execute the scripts "runSolid" and "runFluid"
# in separate terminals.

# Run this script with "-parallel" for parallel simulations

# The script "Allclean" cleans-up the result and log files.
# Set up the run parameters:

# 1 for true, 0 for false
parallel=0
if [ "$1" = "-parallel" ]; then
parallel=1
fi

# =============== Participant 1: Fluid ===========================
Participant1="Fluid"
Solver1="SU2_CFD"
nproc=2

# Run and get the process id
if [ $parallel -eq 1 ]; then
echo " Starting the ${Participant1} participant in parallel..."
mpirun -np ${nproc} ${Solver1} Fluid/euler_config_coupled.cfg > ${Participant1}.log 2>&1 &
else
echo " Starting the ${Participant1} participant in serial..."
${Solver1} Fluid/euler_config_coupled.cfg > ${Participant1}.log 2>&1 &
fi
PIDParticipant1=$!

# =============== Participant 2: Solid ===========================
Participant2="Solid"
Solver2="ccx_preCICE"

# You can use CalculiX CGX to setup the structural simulation from sratch.
# This will re-generate the all.msh, fix1_beam.nam, interface_beam.nam files.
#
# # Prepare in silent mode
# echo "Preparing the ${Participant2} participant..."
# cd ${Participant2}
# echo " Executing cgx (provided by CalculiX, make sure this exists)..."
# cgx -bg pre_flap.fbd > prepare_flap.log 2>&1
# cd ..

# Run
echo " Starting the ${Participant2} participant..."
${Solver2} -i ${Participant2}/flap -precice-participant Calculix > ${Participant2}.log 2>&1 &
PIDParticipant2=$!


# =============== Wait for all the participants to finish =======
echo "Waiting for the participants to exit..., PIDs: ${PIDParticipant1}, ${PIDParticipant2}"
echo "(you may run 'tail -f ${Participant1}.log' in another terminal to check the progress)"

echo "To interrupt the simulation, press 'c'. Ctrl+C will only send the processes to the background."
while [ -e /proc/${PIDParticipant1} ]; do
read -r -t1 -n1 input
if [ "$input" = "c" ]; then
kill ${PIDParticipant1}
kill ${PIDParticipant2}
false
fi
done

if [ $? -ne 0 ] || [ "$(grep -c -E "error:" ${Participant1}.log)" -ne 0 ] || [ "$(grep -c -E "error:" ${Participant2}.log)" -ne 0 ]; then
echo ""
echo "Something went wrong... See the log files for more."
# Precaution
kill ${PIDParticipant1}
kill ${PIDParticipant2}
else
echo ""
echo "The simulation completed! (check for any errors)"
fi
13 changes: 11 additions & 2 deletions FSI/flap_perp/SU2-CalculiX/Fluid/euler_config_coupled.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,14 @@ SOLUTION_FLOW_FILENAME= Fluid/initial_flow.dat
% Output file format (PARAVIEW, TECPLOT, STL)
OUTPUT_FORMAT= PARAVIEW
%
% Output file with the forces breakdown
BREAKDOWN_FILENAME= Fluid/forces_breakdown.dat
%
% Output file restart flow
RESTART_FLOW_FILENAME= Fluid/restart_flow.dat
%
% Output file convergence history (w/o extension)
CONV_FILENAME= history
CONV_FILENAME= Fluid/history
%
% Write binary restart files (YES, NO)
WRT_BINARY_RESTART= NO
Expand All @@ -222,7 +228,10 @@ WRT_BINARY_RESTART= NO
READ_BINARY_RESTART= NO
%
% Output file flow (w/o extension) variables
VOLUME_FLOW_FILENAME= flow
VOLUME_FLOW_FILENAME= Fluid/flow
%
% Output file surface flow coefficient (w/o extension)
SURFACE_FLOW_FILENAME= Fluid/surface_flow
%
% Write surface solution files
WRT_SRF_SOL= NO
Expand Down
Loading