Skip to content

Commit 0135e07

Browse files
authored
two perpendicular flap case (#110)
* draft two perpendicular flap case * Allclean Allrun adapted to two flaps * name changed to solid1_mesh * README update and deal.ii binaris removed * minor changes * name changed to Fluid1-mesh... * delted deal.ii binaries * modified gitignore * minor changes * update nonlinear prm files * gitignore thingie * minor changes * runSolid added * just trying * first wiki draft * wiki draft * wiki * minor changes * working on the mesh * working with smaller velocity * png added * more images * images * images * changes about dealii * english corrections * allclean removes precice-output folder * updated documentation * flap location given as double * wiki content moved to readme file * precice-config.xml formatted using new version Co-authored-by: homspons <ge35joj>
1 parent 77f1a01 commit 0135e07

32 files changed

+1615
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Fluid/*
2+
!Fluid/0.orig
3+
!Fluid/constant/dynamicMeshDict
4+
!Fluid/constant/transportProperties
5+
!Fluid/constant/turbulenceProperties
6+
!Fluid/system
7+
!Fluid/Fluid.foam
8+
*.vtk
9+
*.log
10+
config.dot
11+
config.png
12+
linear_elasticity1
13+
linear_elasticity2
14+
precice-run/
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh
2+
cd ${0%/*} || exit 1 # Run from this directory
3+
4+
echo "Cleaning..."
5+
6+
# Source tutorial clean functions
7+
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
8+
9+
# Participant 1: Fluid (OpenFOAM)
10+
Participant1="Fluid"
11+
cd ${Participant1}
12+
# Clean the case
13+
cleanCase
14+
rm -rfv 0
15+
# Create an empty .foam file for ParaView
16+
# Note: ".foam" triggers the native OpenFOAM reader of ParaView.
17+
# Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM.
18+
touch ${Participant1}.foam
19+
cd ..
20+
# Remove the log files
21+
rm -fv ${Participant1}_blockMesh.log
22+
rm -fv ${Participant1}_checkMesh.log
23+
rm -fv ${Participant1}_decomposePar.log
24+
rm -fv ${Participant1}.log
25+
rm -fv ${Participant1}_reconstructPar.log
26+
27+
# Participant 2: Solid1 (deal.II)
28+
Participant2="Solid1"
29+
cd ./Solid1/dealii_output
30+
# Clean the case
31+
echo "Cleaning Solid1 case"
32+
rm -fv solution-*.vtk
33+
cd ..
34+
rm -fv solution-*.vtk
35+
cd ..
36+
37+
rm -fv ${Participant2}.log
38+
39+
# Participant 3: Solid2 (deal.II)
40+
Participant3="Solid2"
41+
cd ./Solid2/dealii_output
42+
# Clean the case
43+
echo "Cleaning Solid2 case"
44+
rm -fv solution-*.vtk
45+
cd ..
46+
rm -fv solution-*.vtk
47+
cd ..
48+
49+
rm -fv ${Participant3}.log
50+
51+
# Remove the preCICE-related log files
52+
echo "Deleting the preCICE log files..."
53+
rm -fv \
54+
precice-*.log \
55+
precice-*-events.json
56+
57+
rm -rfv precice-run
58+
rm -rfv precice-output
59+
60+
61+
echo "Cleaning complete!"
62+
#------------------------------------------------------------------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
2+
3+
cd ${0%/*} || exit 1 # Run from this directory
4+
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
5+
6+
# This script prepares and runs all the participants in one terminal,
7+
# forwarding the solvers' output to log files.
8+
# Alternatively, you may execute the script "runFluid" and start the Solid participants manually
9+
# in separate terminals.
10+
11+
# Run this script with "-parallel" for parallel simulations
12+
13+
# The script "Allclean" cleans-up the result and log files.
14+
# Set up the run parameters:
15+
16+
# 1 for true, 0 for false
17+
parallel=0
18+
if [ "$1" = "-parallel" ]; then
19+
parallel=1
20+
fi
21+
22+
# =============== Participant 1: Fluid ===========================
23+
Participant1="Fluid"
24+
25+
# Prepare
26+
echo "Preparing the ${Participant1} participant..."
27+
28+
cd $Participant1
29+
echo " Restoring 0/ from 0.orig/..."
30+
rm -rfv 0
31+
cp -r 0.orig 0
32+
cd ..
33+
34+
echo " Preparing the mesh..."
35+
blockMesh -case ${Participant1} > ${Participant1}_blockMesh.log 2>&1
36+
checkMesh -case ${Participant1} > ${Participant1}_checkMesh.log 2>&1
37+
38+
# get application information
39+
cd ${Participant1}
40+
Solver1=$(getApplication) # solver
41+
echo " ${Participant1} Solver: ${Solver1}."
42+
cd ..
43+
44+
# Run and get the process id
45+
if [ $parallel -eq 1 ]; then
46+
echo " Decomposing the case..."
47+
decomposePar -force -case ${Participant1} > ${Participant1}_decomposePar.log 2>&1
48+
cd ${Participant1}
49+
nproc=$(getNumberOfProcessors)
50+
cd ..
51+
echo " Starting the ${Participant1} participant in parallel..."
52+
mpirun -np ${nproc} ${Solver1} -parallel -case ${Participant1} > ${Participant1}.log 2>&1 &
53+
else
54+
echo " Starting the ${Participant1} participant in serial..."
55+
${Solver1} -case ${Participant1} > ${Participant1}.log 2>&1 &
56+
fi
57+
PIDParticipant1=$!
58+
59+
# =============== Participant 2: Solid1 ===========================
60+
Participant2="Solid1"
61+
Solver2="linear_elasticity1"
62+
63+
# Run
64+
echo " Starting the ${Participant2} participant..."
65+
./runSolid1 -linear > ${Participant2}.log 2>&1 &
66+
PIDParticipant2=$!
67+
68+
69+
# =============== Participant 3: Solid2 ===========================
70+
Participant3="Solid2"
71+
Solver3="linear_elasticity2"
72+
73+
# Run
74+
echo " Starting the ${Participant3} participant..."
75+
./runSolid2 -linear > ${Participant3}.log 2>&1 &
76+
PIDParticipant3=$!
77+
78+
79+
# =============== Wait for all the participants to finish =======
80+
echo "Waiting for the participants to exit..., PIDs: ${PIDParticipant1}, ${PIDParticipant2}, ${PIDParticipant3}"
81+
echo "(you may run 'tail -f ${Participant1}.log' in another terminal to check the progress)"
82+
83+
echo "To interrupt the simulation, press 'c'. Ctrl+C will only send the processes to the background."
84+
while [ -e /proc/${PIDParticipant1} ]; do
85+
read -r -t1 -n1 input
86+
if [ "$input" = "c" ]; then
87+
kill ${PIDParticipant1}
88+
kill ${PIDParticipant2}
89+
kill ${PIDParticipant3}
90+
false
91+
fi
92+
done
93+
94+
if [ $? -ne 0 ] || [ "$(grep -c -E "error:" ${Participant1}.log)" -ne 0 ] || [ "$(grep -c -E "error:" ${Participant2}.log)" -ne 0 ] || [ "$(grep -c -E "error:" ${Participant3}.log)" -ne 0 ]; then
95+
echo ""
96+
echo "Something went wrong... See the log files for more."
97+
# Precaution
98+
kill ${PIDParticipant1}
99+
kill ${PIDParticipant2}
100+
kill ${PIDParticipant3}
101+
102+
else
103+
echo ""
104+
echo "The simulation completed! (check for any errors)"
105+
if [ $parallel -eq 1 ]; then
106+
echo "Reconstructing fields..."
107+
reconstructPar -case ${Participant1} > ${Participant1}_reconstructPar.log 2>&1 &
108+
fi
109+
110+
# Workaround for issue #26
111+
echo "Problems with time directories without results? Run the script removeObsoleteFolders.sh and see issue #26 on GitHub."
112+
# ./removeObsoleteFolders.sh
113+
114+
echo "You may now open '${Participant1}/${Participant1}.foam' in ParaView."
115+
# Note: ".foam" triggers the native OpenFOAM reader of ParaView.
116+
# Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM.
117+
fi
118+
119+
echo ""
120+
echo "### NOTE ### Make sure to use the correct solver for your OpenFOAM version! (pimpleFoam for OpenFOAM v1806, OpenFOAM 6, or newer, vs pimpleDyMFoam for older) You may change this in your Fluid/system/controlDict file, if needed."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volVectorField;
6+
location "0";
7+
object U;
8+
}
9+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
10+
11+
dimensions [0 1 -1 0 0 0 0];
12+
13+
internalField uniform (5 0 0);
14+
15+
boundaryField
16+
{
17+
inlet
18+
{
19+
type fixedValue;
20+
value $internalField;
21+
}
22+
outlet
23+
{
24+
type zeroGradient;
25+
}
26+
flap1
27+
{
28+
type movingWallVelocity;
29+
value uniform (0 0 0);
30+
}
31+
flap2
32+
{
33+
type movingWallVelocity;
34+
value uniform (0 0 0);
35+
}
36+
upperWall
37+
{
38+
type noSlip;
39+
}
40+
lowerWall
41+
{
42+
type noSlip;
43+
}
44+
frontAndBack
45+
{
46+
type empty;
47+
}
48+
}
49+
50+
51+
// ************************************************************************* //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class volScalarField;
6+
object p;
7+
}
8+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9+
10+
dimensions [0 2 -2 0 0 0 0];
11+
12+
internalField uniform 0;
13+
14+
boundaryField
15+
{
16+
inlet
17+
{
18+
type zeroGradient;
19+
}
20+
21+
outlet
22+
{
23+
type fixedValue;
24+
value uniform 0;
25+
}
26+
27+
flap1
28+
{
29+
type zeroGradient;
30+
}
31+
32+
flap2
33+
{
34+
type zeroGradient;
35+
}
36+
37+
upperWall
38+
{
39+
type zeroGradient;
40+
}
41+
42+
lowerWall
43+
{
44+
type zeroGradient;
45+
}
46+
47+
frontAndBack
48+
{
49+
type empty;
50+
}
51+
}
52+
53+
// ************************************************************************* //
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FoamFile
2+
{
3+
version 2.0;
4+
format ascii;
5+
class surfaceScalarField;
6+
location "0";
7+
object phi;
8+
}
9+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
10+
11+
dimensions [0 3 -1 0 0 0 0];
12+
13+
internalField uniform 0;
14+
boundaryField
15+
{
16+
inlet
17+
{
18+
type calculated;
19+
value $internalField;
20+
}
21+
outlet
22+
{
23+
type calculated;
24+
value $internalField;
25+
}
26+
flap1
27+
{
28+
type calculated;
29+
value uniform 0;
30+
}
31+
flap2
32+
{
33+
type calculated;
34+
value uniform 0;
35+
}
36+
upperWall
37+
{
38+
type calculated;
39+
value uniform 0;
40+
}
41+
lowerWall
42+
{
43+
type calculated;
44+
value uniform 0;
45+
}
46+
frontAndBack
47+
{
48+
type empty;
49+
value nonuniform 0;
50+
}
51+
}
52+
53+
54+
// ************************************************************************* //

0 commit comments

Comments
 (0)