Skip to content

two perpendicular flap case #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions FSI/two_flap_perp_2D/OpenFOAM-deal.II/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Fluid/*
!Fluid/0.orig
!Fluid/constant/dynamicMeshDict
!Fluid/constant/transportProperties
!Fluid/constant/turbulenceProperties
!Fluid/system
!Fluid/Fluid.foam
*.vtk
*.log
config.dot
config.png
linear_elasticity1
linear_elasticity2
precice-run/

62 changes: 62 additions & 0 deletions FSI/two_flap_perp_2D/OpenFOAM-deal.II/Allclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory

echo "Cleaning..."

# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions

# Participant 1: Fluid (OpenFOAM)
Participant1="Fluid"
cd ${Participant1}
# Clean the case
cleanCase
rm -rfv 0
# Create an empty .foam file for ParaView
# Note: ".foam" triggers the native OpenFOAM reader of ParaView.
# Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM.
touch ${Participant1}.foam
cd ..
# Remove the log files
rm -fv ${Participant1}_blockMesh.log
rm -fv ${Participant1}_checkMesh.log
rm -fv ${Participant1}_decomposePar.log
rm -fv ${Participant1}.log
rm -fv ${Participant1}_reconstructPar.log

# Participant 2: Solid1 (deal.II)
Participant2="Solid1"
cd ./Solid1/dealii_output
# Clean the case
echo "Cleaning Solid1 case"
rm -fv solution-*.vtk
cd ..
rm -fv solution-*.vtk
cd ..

rm -fv ${Participant2}.log

# Participant 3: Solid2 (deal.II)
Participant3="Solid2"
cd ./Solid2/dealii_output
# Clean the case
echo "Cleaning Solid2 case"
rm -fv solution-*.vtk
cd ..
rm -fv solution-*.vtk
cd ..

rm -fv ${Participant3}.log

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

rm -rfv precice-run
rm -rfv precice-output


echo "Cleaning complete!"
#------------------------------------------------------------------------------
120 changes: 120 additions & 0 deletions FSI/two_flap_perp_2D/OpenFOAM-deal.II/Allrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/bash

cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions

# This script prepares and runs all the participants in one terminal,
# forwarding the solvers' output to log files.
# Alternatively, you may execute the script "runFluid" and start the Solid participants manually
# 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"

# Prepare
echo "Preparing the ${Participant1} participant..."

cd $Participant1
echo " Restoring 0/ from 0.orig/..."
rm -rfv 0
cp -r 0.orig 0
cd ..

echo " Preparing the mesh..."
blockMesh -case ${Participant1} > ${Participant1}_blockMesh.log 2>&1
checkMesh -case ${Participant1} > ${Participant1}_checkMesh.log 2>&1

# get application information
cd ${Participant1}
Solver1=$(getApplication) # solver
echo " ${Participant1} Solver: ${Solver1}."
cd ..

# Run and get the process id
if [ $parallel -eq 1 ]; then
echo " Decomposing the case..."
decomposePar -force -case ${Participant1} > ${Participant1}_decomposePar.log 2>&1
cd ${Participant1}
nproc=$(getNumberOfProcessors)
cd ..
echo " Starting the ${Participant1} participant in parallel..."
mpirun -np ${nproc} ${Solver1} -parallel -case ${Participant1} > ${Participant1}.log 2>&1 &
else
echo " Starting the ${Participant1} participant in serial..."
${Solver1} -case ${Participant1} > ${Participant1}.log 2>&1 &
fi
PIDParticipant1=$!

# =============== Participant 2: Solid1 ===========================
Participant2="Solid1"
Solver2="linear_elasticity1"

# Run
echo " Starting the ${Participant2} participant..."
./runSolid1 -linear > ${Participant2}.log 2>&1 &
PIDParticipant2=$!


# =============== Participant 3: Solid2 ===========================
Participant3="Solid2"
Solver3="linear_elasticity2"

# Run
echo " Starting the ${Participant3} participant..."
./runSolid2 -linear > ${Participant3}.log 2>&1 &
PIDParticipant3=$!


# =============== Wait for all the participants to finish =======
echo "Waiting for the participants to exit..., PIDs: ${PIDParticipant1}, ${PIDParticipant2}, ${PIDParticipant3}"
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}
kill ${PIDParticipant3}
false
fi
done

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
echo ""
echo "Something went wrong... See the log files for more."
# Precaution
kill ${PIDParticipant1}
kill ${PIDParticipant2}
kill ${PIDParticipant3}

else
echo ""
echo "The simulation completed! (check for any errors)"
if [ $parallel -eq 1 ]; then
echo "Reconstructing fields..."
reconstructPar -case ${Participant1} > ${Participant1}_reconstructPar.log 2>&1 &
fi

# Workaround for issue #26
echo "Problems with time directories without results? Run the script removeObsoleteFolders.sh and see issue #26 on GitHub."
# ./removeObsoleteFolders.sh

echo "You may now open '${Participant1}/${Participant1}.foam' in ParaView."
# Note: ".foam" triggers the native OpenFOAM reader of ParaView.
# Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM.
fi

echo ""
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."
51 changes: 51 additions & 0 deletions FSI/two_flap_perp_2D/OpenFOAM-deal.II/Fluid/0.orig/U
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (5 0 0);

boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
outlet
{
type zeroGradient;
}
flap1
{
type movingWallVelocity;
value uniform (0 0 0);
}
flap2
{
type movingWallVelocity;
value uniform (0 0 0);
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}


// ************************************************************************* //
53 changes: 53 additions & 0 deletions FSI/two_flap_perp_2D/OpenFOAM-deal.II/Fluid/0.orig/p
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type zeroGradient;
}

outlet
{
type fixedValue;
value uniform 0;
}

flap1
{
type zeroGradient;
}

flap2
{
type zeroGradient;
}

upperWall
{
type zeroGradient;
}

lowerWall
{
type zeroGradient;
}

frontAndBack
{
type empty;
}
}

// ************************************************************************* //
54 changes: 54 additions & 0 deletions FSI/two_flap_perp_2D/OpenFOAM-deal.II/Fluid/0.orig/phi
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 3 -1 0 0 0 0];

internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value $internalField;
}
outlet
{
type calculated;
value $internalField;
}
flap1
{
type calculated;
value uniform 0;
}
flap2
{
type calculated;
value uniform 0;
}
upperWall
{
type calculated;
value uniform 0;
}
lowerWall
{
type calculated;
value uniform 0;
}
frontAndBack
{
type empty;
value nonuniform 0;
}
}


// ************************************************************************* //
Loading