Professional Documents
Culture Documents
January 6, 2011
1
Contents
1 The Purpose 3
2 Preliminary remark 3
4 Installation of Distributions 3
4.1 OpenFOAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 DEAL.II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.3 ICOFSI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 The Mesh 5
5.1 OpenFOAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2 DEAL.II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.3 Boundary specification . . . . . . . . . . . . . . . . . . . . . . 5
8 Contact 7
2
1 The Purpose
A description of the installation and the input to the C++ package ICOFSI.
2 Preliminary remark
The diploma work contains further technical details of the implementation
[1]. The reader should regard this document as a complement to section 3.1
in this thesis. At present, the source code is provided by the author of the
project through email. Note: The reader of this document is assumed to have
knowledge of DEAL.II and OpenFOAM.
• unpack ICOFSI
4 Installation of Distributions
Install the latest version of the packages. Read the README files. Verify the
distribution by running tutorials and control that all third party programs
are not conflicting the distributions. Important: The compiler must be the
same for both packages.
4.1 OpenFOAM
If older distributions than OpenFOAM 1.6 is used for OpenFOAM, some
modification of the code is necessary since the option flags for running Open-
FOAM case have been modified which affect the path variables used in the
3
load and write routines such as in dealiiGrid and DynamicElastic. See Ap-
pendix, [Older distribution than OpenF OAM 1.6]. The OpenFOAM pack-
age is downloaded from http://www.openfoam.com/. For most linux plat-
forms the following command is often sufficient, from the root of the distri-
bution catalogue,
wmake all
Recommendation: Download the binaries, see for further detailed instruc-
tions [9].
4.2 DEAL.II
The deal.II package is downloaded from http://www.dealii.com [8]. For most
linux platforms the following is sufficient, from the root of the distribution
catalogue,
./configure
make all
Note: If binaries used for OpenFOAM, the provided compiler must be used
by ./configure options.
4.3 ICOFSI
ICOFSI is written in the OpenFOAM context. Place all code under a di-
rectory together with a M ake directory and compile by wmake gives an
executable defined in Make/file. See Appendix [ICOF SI Installation] for
a details. An overview of the key files,
• icofsi.C, the main code, icoDymFOAM as template. Contain the defi-
nition of the traction.
• DynamicElastic.H, the structured part solver, step-8 as template.
• IcoDymFOAN.H, the kernel of template for icofsi.C, the fluid part
solver.
• dealiiGrid.H, the mesh handler for structured grid.
• AutoMesh.H, the ALE step.
• InterGridMapping.H, the mapping between fluid and structured mesh
[ALE].
• SetBoundaryIndicator.H, defines the boundary condition by proximity
between fluid and structure.
The main code is icof si.C involves both OpenFOAM and DEAL.II context
using namespace technique.
4
5 The Mesh
5.1 OpenFOAM
The boundaries to be specified is called patches in OpenFOAM, see Ap-
pendix [constant/couplingP arameters]. The procedure in generating fluid
mesh for OpenFOAM is straightforward, there is several conversion routines
that is available [2]. It is recommended that a quadrilateral mesh is applied
on the contact surface to the structure. The there is only one patch for the
fixed surface.
5.2 DEAL.II
For structured grid, the DEAL.II offers several options but the version 0.9
code is restricted to .msh format [7]. For more advanced mesh generator
than primitives see Appendix [Gmesh]. The class dealiiGrid handle the
DEAL.II I/O for the structure regarding the loading/writing mesh.
6.2 DEAL.II
The input for the structured solver is specified by input file < name >.prgm,
the < name > is specified in Appendix [constant/couplingP arameters],
placed under OpenFOAM syntax case structure, see Appendix [Case]. The
5
keywords in this file is specified by define the sub category and then param-
eter name, see Appendix [T he keywords f or dealiiP arameterHandler].
The subcategory have the syntax subsection < name > with end marker
< end >, the parameter is defined by syntax set < name of parameter >
< value >. As an example,
• Install and verify each package using icoDymFOAM and step-8 tuto-
rials.
• Run the Case using icoDymF oam solver to stationary fluid state [2]
• Evaluate the mean frontal pressure on the structure from the input
from previous step
• Run ICOFSI with stationary flow and settings for stable structure.
6
7.3 Setting the damping
Damping is vital to remove the initial energy by holding structure to fixed
position, depending on the Case, the necessity for restart and use new damp-
ing can be optional choice while reducing the computational effort. Regard-
ing the specify the mean pressure for deal.ii, either one set this through
using OpenFOAM or see Appendix [Testing the structure]
8 Contact
If you experience some problem during installation or have any comments
upon the code, please contact me at johan lorentzon@hotmail.com
7
References
[1] Fluid-Structure Interaction (FSI) case study of a cantilever us-
ing OpenFOAM and DEAL.II with application to VIV, ISRN
LUTMDN/TMHP–09/5186–SE.
[2] http://www.openfoam.com/docs/user.
[3] Which strategy to move the mesh in the. Computational Fluid Dynamic
code. OpenFOAM. Christophe Kassiotis. April 12, 2008. cole Normale
Suprieure de Cachan.
[4] http://www.dealii.org/developer/doxygen/tutorial/index.html .
[5] https://help.ubuntu.com/community/OpenFOAM.
[6] http://www.openfoam.com/download/source.php.
[7] http://geuz.org/gmsh/.
[8] http://www.dealii.org/developer/readme.html#installation.
8
Appendix: ICOFSI installation
Make/file
cyclicHashTable.C
icofsi.C
EXE = \$(FOAM_USER_APPBIN)/ICOFSI
Make/option
EXE_INC = \
\$(WM_DECOMP_INC) \
-I\$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I\$(LIB_SRC)/dynamicMesh/lnInclude \
-I\$(LIB_SRC)/meshTools/lnInclude \
-I\$(LIB_SRC)/cfdTools/incompressible \
-I\$(LIB_SRC)/finiteVolume/lnInclude \
-I\$(LIB_SRC)/dynamicMesh/motionSolver \
-I /home/\$(USER)/deal.II/contrib/boost/include \
-I /home/\$(USER)/deal.II/lac/include \
-I /home/\$(USER)/deal.II/base/include \
-I /home/\$(USER)/deal.II/deal.II/include
EXE_LIBS = \
-ldynamicFvMesh \
-ldynamicMesh \
-lmeshTools \
-lfiniteVolume \
-ltriSurface \
/home/\$(USER)/deal.II/lib/libbase.g.so\
/home/\$(USER)/deal.II/lib/libdeal_II_3d.g.so\
/home/\$(USER)/deal.II/lib/liblac.g.so\
/home/\$(USER)/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/\
"linux64"/lib64/libstdc++.so.6
Important: The last line refer to the libstdc++ library its related to current
compilator and both distribution must use the same.
9
Case
A case contain all input files and output, each placed under specified direc-
tories,
Case
0
U
p
pointDisplacement
cellDisplacement
cellMotionU
...
constant
couplingParameter
transportProperties
dynamicMeshDictionary
...
deal.ii
constant
<name>
output
<name>.prgm
marker
system
controlDict
...
Note: The 0 Case represent the start time of the simulation, could be set
arbitrary according to the input file controlDict.
10
Older distribution than OpenFOAM 1.6
The current distribution 1.7 use a syntax for path description not compati-
ble to older version 1.5 and earlier. The locations to change the path settings
can be found,
dealiiGrid.H:
Dynamicelastic.H:
In both snippets it is the arglist that cause eventual problem running the
code.
11
constant/couplingParameter
This input file defines the number of structural elements in the calculation
[nObject], density of fluid [Density], time for start of FSI [time], label of
the boundaries[f luidSide,solidSide]. The vector after label is the SI unit
specification. The f luidSide and solidSide defines the tag used for label
the boundary for OpenFOAM respectively naming the input/output files
for DEAL.II. To separate multiples of surfaces/structures The OpenFOAM
mesh tags is differentiated by a suffix from 2 to nObjects + 1 [ 1 refers to the
fixed surface domain under one patch], while for DEAL.II the input/output
files for structures are by suffix enumerated from 0 till nObjects − 1. An
example,
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class dictionary;
object couplingParameters;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nObject nObject [0 0 0 0 0 0 0] 1.0;
fluidSide SURFACE;
solidSide object;
Density Density [1 -3 0 0 0 0 0] 1000.0;
startMeshMotion time [0 0 1 0 0 0 0] 7.065;
// ************************************************************************* //
12
0/U
The patch [boundary condition] is f ixedV alue for fixed wall and movingW allV elocity
for the structural element that are allowed to interact. This is a velocity
driven fluid but the dirichlet set inlet of U.
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class volVectorField;
object U;
}
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
INLET
{
type fixedValue;
value uniform (1.0 0 0);
}
SURFACE1
{
type fixedValue;
value uniform (0 0 0);
}
SURFACE2
{
type movingWallVelocity;
value uniform (0 0 0);
}
OUTLET
{
type zeroGradient;
}
}
13
0/p
The patch [boundary condition] is f ixedV alue for fixed wall and movingW allV elocity
for the structural element that are allowed to interact. Note the pressure set
to 0 at outlet and 0 gradient for the purpose of consistency with specification
of a velocity driven fluid.
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class volScalarField;
object p;
}
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
SURFACE1
{
type zeroGradient;
}
SURFACE2
{
type zeroGradient;
}
OUTLET
{
type fixedValue;
value uniform 0;
}
INLET
{
type zeroGradient;
}
}
14
constant/dynamicMeshDict
This section specify what kind of solver to be used to solve the laplacian
that defines the deformation in the ALE step. For further details, see [3].
Related input files are cellDisplacement, pointdisplacement,cellmotionU,
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class dictionary;
object motionProperties;
}
twoDMotion no;
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");
solver displacementLaplacian;
diffusivity quadratic inverseDistance 1(SURFACE2);
(
);
15
0/cellMotionU
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class volVectorField;
object motionU;
}
dimensions [0 1 -1 0 0 0 0];
boundaryField
{
INLET
{
type fixedValue;
value uniform (0 0 0);
}
SURFACE1
{
type fixedValue;
value uniform (0 0 0);
}
SURFACE2
{
type fixedValue;
value uniform (0 0 0);
}
OUTLET
{
type zeroGradient;
}
}
16
0/cellDisplacement
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class volVectorField;
object cellDisplacement;
}
dimensions [0 1 0 0 0 0 0];
boundaryField
{
SURFACE2
{
type fixedValue;
value uniform (0 0 0);
}
SURFACE1
{
type fixedValue;
value uniform (0 0 0);
}
INLET
{
type fixedValue;
value uniform (0 0 0);
}
OUTLET
{
type fixedValue;
value uniform (0 0 0);
}
}
17
0/pointDisplacement
Note: calculated from cellDisplacement, hence flexible structure should have
calculated patch.
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class pointVectorField;
object pointDisplacement;
}
dimensions [0 1 0 0 0 0 0];
boundaryField
{
SURFACE2
{
type calculated;
}
SURFACE1
{
type fixedValue;
value uniform (0 0 0);
}
INLET
{
type fixedValue;
value uniform (0 0 0);
}
OUTLET
{
type fixedValue;
value uniform (0 0 0);
}
}
18
constant/transportProperties
This file defines the kinematic viscosity.
FoamFile
{
version 2.0;
format ascii;
root "";
case "";
instance "";
local "";
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu nu [0 2 -1 0 0 0 0] 5e-4;
// ************************************************************************* //
19
deal.ii/object0.prgm
subsection FEM
set The Write Interval = 250
set The Order of FE_QGauss = 1
set The Order of Gauss Quadrature = 2
set The Number of Refinements = 1
set The Number of Cycles = 1
end
deal.ii/marker
The first line presents starting time of evaluate the probes, the number of
probes. Second line contains the probes coordinates in (x,y,z).
7.06301 3
1.1 0.6 1.95 1.01 0.6 1.0 1.18 0.6 1.0
Note: The point must be inside the structure element not onto surface due
to the search function assumes strictly inside [<].
20
The keywords for dealiiP arameterHandler
The following list the parameters where the first name is the subcategory
they placed under. The definitions of reading parameters are in dealiiP arameterHandler.
21
Gmesh
Here follows a short quote from a forum in how to generate hexahedral mesh
for DEAL.II using gmesh utility.
void Grid<dim>::create_grid ()
{
std::vector<double> step_x(4,0.05),step_y(4,.05),step_z(16,0.125);
std::vector<std::vector<double> > step_size(3);
step_size.at(0)=step_x; step_size.at(1)=step_y; step_size.at(2)=step_z;
const Point<3> p1(1.4,0.50,.0),p2(1.6,0.7,2.0);
const bool flag=false;
GridGenerator::subdivided_hyper_rectangle(triangulation,step_size,p1,p2,flag);
boundary();
if (filename.size()) save();
}
Remark: Be aware that round off error affect the routine directly and er-
ror will be produced. No round off than floating point related in the step
declaration.
22
Testing the structure
The Main code is,
#include "InterGridMapping.H"
namespace shared
{
InterGridMapping<3>* icofsi_db_list[10] ;
InterGridMapping<3> icofsi_db;
}
// DYNAMIC
#include "DynamicElastic.H"
#include "dealiiGrid.H"
#include "setBoundaryIndicator.H"
#include "dealiiParameterHandler.H"
int main(int argc,char* argv[]) {
shared::icofsi_db_list[0] = new InterGridMapping<3>();
dealiiParameterHandler::Base prm(argv,"object0.prm");
prm.print();
int i=0;
SmartPointer<Triangulation<3> > tria;
dealiiGrid::Grid<3> newGrid;
newGrid.set_path(argv,"object");
newGrid.create_grid();
tria=newGrid.get_triangulation();
DynamicElastic::TopLevel<3> test(prm,tria,i);
test.set_grid_path(argv,"object");
double time_is_everything=0;
while(time_is_everything<1) {
test.set_current_time(time_is_everything);
time_is_everything+=0.001;
test.run();
test.next_step();
}
}
To apply the pressure, modify DynamicElastic.H at the following point,
for ( unsigned int q_point=0;q_point<n_face_q_points;++q_point) {
// DO: calculate pressure function
cell_rhs(i)+=shared::icofsi_db_list[n_object]->get_traction(component_i,cell->face_i
invrho*fe_face_values.shape_value(i,q_point)*fe_face_values.JxW(q_point
}
Replace the shared :: icof si db list[n object]− > get traction(component i, cell− >
f ace index(f ace)) to a specific value or use exact pressure from an Open-
Foam calculation.
23