23
Technical Documentation: ICOFSI version 0.9 January 6, 2011 1

Technical documentation for ICOFSI

Embed Size (px)

DESCRIPTION

Installation procedure and input for ICOFSI used in thesis is elaborated. For access of the code, see contact in the document.

Citation preview

Page 1: Technical documentation for ICOFSI

Technical Documentation: ICOFSI version 0.9

January 6, 2011

1

Page 2: Technical documentation for ICOFSI

Contents

1 The Purpose 3

2 Preliminary remark 3

3 Overview of the installation 3

4 Installation of Distributions 34.1 OpenFOAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.2 DEAL.II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44.3 ICOFSI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

5 The Mesh 55.1 OpenFOAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55.2 DEAL.II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55.3 Boundary specification . . . . . . . . . . . . . . . . . . . . . . 5

6 The Input to ICOFSI 56.1 OpenFOAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56.2 DEAL.II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

7 Putting all together 67.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67.2 Flow chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67.3 Setting the damping . . . . . . . . . . . . . . . . . . . . . . . 77.4 Setting the threshold . . . . . . . . . . . . . . . . . . . . . . . 7

8 Contact 7

2

Page 3: Technical documentation for ICOFSI

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.1in this thesis. At present, the source code is provided by the author of theproject through email. Note: The reader of this document is assumed to haveknowledge of DEAL.II and OpenFOAM.

3 Overview of the installation

The code ICOFSI is written in the context of OpenFOAM using namespacetechnique to encapsulate DEAL.II,

• Download the distributions from www.dealii.com and www.openfoam.com.

• Install each distribution separately by following instructions [8, 9].

• verify the correctness of distribution separately by execute tutorials.

• unpack ICOFSI

• open Make/file and Make/options and make necessary changes.

• verify ICOFSI by apply executable on reference case

Note:Follow the README, but if binaries is used from OpenFOAM, en-sure that alla common libraries and DEAL.II is compiled with the compilerprovided in that distribution.

4 Installation of Distributions

Install the latest version of the packages. Read the README files. Verify thedistribution by running tutorials and control that all third party programsare not conflicting the distributions. Important : The compiler must be thesame for both packages.

4.1 OpenFOAM

If older distributions than OpenFOAM 1.6 is used for OpenFOAM, somemodification 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

Page 4: Technical documentation for ICOFSI

load and write routines such as in dealiiGrid and DynamicElastic. See Ap-pendix, [Older distribution than OpenFOAM1.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 mostlinux platforms the following is sufficient, from the root of the distributioncatalogue,

./configuremake all

Note: If binaries used for OpenFOAM, the provided compiler must be usedby ./configure options.

4.3 ICOFSI

ICOFSI is written in the OpenFOAM context. Place all code under a di-rectory together with a Make directory and compile by wmake gives anexecutable defined in Make/file. See Appendix [ICOFSI Installation] fora 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 partsolver.

• 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 proximitybetween fluid and structure.

The main code is icofsi.C involves both OpenFOAM and DEAL.II contextusing namespace technique.

4

Page 5: Technical documentation for ICOFSI

5 The Mesh

5.1 OpenFOAM

The boundaries to be specified is called patches in OpenFOAM, see Ap-pendix [constant/couplingParameters]. The procedure in generating fluidmesh for OpenFOAM is straightforward, there is several conversion routinesthat is available [2]. It is recommended that a quadrilateral mesh is appliedon the contact surface to the structure. The there is only one patch for thefixed surface.

5.2 DEAL.II

For structured grid, the DEAL.II offers several options but the version 0.9code is restricted to .msh format [7]. For more advanced mesh generatorthan primitives see Appendix [Gmesh]. The class dealiiGrid handle theDEAL.II I/O for the structure regarding the loading/writing mesh.

5.3 Boundary specification

There is a routine that automatic matches couplings surfaces, the setBoundaryIndicator.H,which project each fluid face point at couplings surface onto each structureface element and if within a threshold to the cell surface it is marked Neu-mann [movable] and Dirichlet otherwise [fixed]. This require however thatthe fluid mesh is to be finer than the structure initial before refinement isapplied, which calls for the reason using this parameter cycle/refinement.Note: threshold for surface normal alignment and the distance can be re-quired to be changed for the purpose of correct mapping.

6 The Input to ICOFSI

6.1 OpenFOAM

The input for the fluid solver requires specification of velocity field U ,pressure field p and few other parameters. The specification can be con-sulted by OpenFOAM guides with example input files given in Appendix[0/U ,0/p,0/pointDisplacement ...] as support. One important aspect is thedetermination of the driven force of the fluid, namely, pressure or velocitydriven. The effects are chosen patch [=boundary condition for OpenFOAM].

6.2 DEAL.II

The input for the structured solver is specified by input file < name >.prgm,the < name > is specified in Appendix [constant/couplingParameters],placed under OpenFOAM syntax case structure, see Appendix [Case]. The

5

Page 6: Technical documentation for ICOFSI

keywords in this file is specified by define the sub category and then param-eter name, see Appendix [The keywords for dealiiParameterHandler].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,

subsection Dynamical Constantsset The Alpha Damping Coefficient = 0.0set The Beta Damping Coefficient = 0.0

end

Note: the input is case sensitive. See Appendix [dealii/marker0,dealii/object0.prgm]for example files.

7 Putting all together

7.1 General

The project is executed in same way as icoDymFoam, a tutorial in Open-FOAM. The time step and write interval is set by system/controlDict [affectboth packages]. The mesh for structure is placed in deal.ii/constant whilethe fluid follow the OpenFOAM standard, in this example by 0 catalogue.The restart vectors [u restart, v restart]in output deal.ii/ouput match thelatest catalogue for OpenFOAM.

7.2 Flow chart

Break down the procedure into the following steps,

• Install and verify each package using icoDymFOAM and step-8 tuto-rials.

• Create Case [See Appendix]

• Create Mesh [Section 5]

• Run the Case using icoDymFoam solver to stationary fluid state [2]

• Evaluate the mean frontal pressure on the structure from the inputfrom previous step

• Run the structure solver DynamicElastic with mean frontal pressurespecified from previous step.

• Run ICOFSI with stationary flow and settings for stable structure.

6

Page 7: Technical documentation for ICOFSI

7.3 Setting the damping

Damping is vital to remove the initial energy by holding structure to fixedposition, 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 throughusing OpenFOAM or see Appendix [Testing the structure]

7.4 Setting the threshold

An important task for partitioned solvers is the setting of thresholds, there isa trial and error in choosing parameters and in some cases no such is feasible.See diploma work for further details [1]. Improper settings often leads tonumerical instability manifested as Floating point exception, divergence,drifting.

8 Contact

If you experience some problem during installation or have any commentsupon the code, please contact me at johan [email protected]

7

Page 8: Technical documentation for ICOFSI

References

[1] Fluid-Structure Interaction (FSI) case study of a cantilever us-ing OpenFOAM and DEAL.II with application to VIV, ISRNLUTMDN/TMHP–09/5186–SE.

[2] http://www.openfoam.com/docs/user.

[3] Which strategy to move the mesh in the. Computational Fluid Dynamiccode. OpenFOAM. Christophe Kassiotis. April 12, 2008. cole NormaleSuprieure 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.

[9] http://www.openfoamwiki.net/index.php/Howto compile OpenFOAM.

8

Page 9: Technical documentation for ICOFSI

Appendix: ICOFSI installation

Make/file

cyclicHashTable.Cicofsi.CEXE = \$(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 currentcompilator and both distribution must use the same.

9

Page 10: Technical documentation for ICOFSI

Case

A case contain all input files and output, each placed under specified direc-tories,

Case0

UppointDisplacementcellDisplacementcellMotionU...

constantcouplingParametertransportPropertiesdynamicMeshDictionary...

deal.iiconstant

<name>output<name>.prgmmarker

systemcontrolDict...

Note: The 0 Case represent the start time of the simulation, could be setarbitrary according to the input file controlDict.

10

Page 11: Technical documentation for ICOFSI

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 settingscan be found,

dealiiGrid.H:

void Grid<dim>::set_path(char* arglist[], const char name[]){

filename.append(arglist[2]);filename.append("/deal.ii/constant/");filename.append(name);

}

Dynamicelastic.H:

void TopLevel<dim>::set_grid_path( char* arglist[], const char name[]){

filename.append(arglist[2]);path=filename;path.append("/");printf("%s\n",path.c_str());filename.append(name);

}

In both snippets it is the arglist that cause eventual problem running thecode.

11

Page 12: Technical documentation for ICOFSI

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 ofthe boundaries[fluidSide,solidSide]. The vector after label is the SI unitspecification. The fluidSide and solidSide defines the tag used for labelthe boundary for OpenFOAM respectively naming the input/output filesfor DEAL.II. To separate multiples of surfaces/structures The OpenFOAMmesh tags is differentiated by a suffix from 2 to nObjects+1 [ 1 refers to thefixed surface domain under one patch], while for DEAL.II the input/outputfiles for structures are by suffix enumerated from 0 till nObjects − 1. Anexample,

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;// ************************************************************************* //

SURFACE1 refers to the fixed wall, SURFACE2 is the flexible structuredpart specified in the tags for the respective surface if fluid mesh to Open-FOAM. The object0.prgm is the input file to DEAL.II solver and marker0the probes.

12

Page 13: Technical documentation for ICOFSI

0/U

The patch [boundary condition] is fixedV alue for fixed wall and movingWallV elocityfor the structural element that are allowed to interact. This is a velocitydriven 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

Page 14: Technical documentation for ICOFSI

0/p

The patch [boundary condition] is fixedV alue for fixed wall and movingWallV elocityfor the structural element that are allowed to interact. Note the pressure setto 0 at outlet and 0 gradient for the purpose of consistency with specificationof 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

Page 15: Technical documentation for ICOFSI

constant/dynamicMeshDict

This section specify what kind of solver to be used to solve the laplacianthat 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

Page 16: Technical documentation for ICOFSI

0/cellMotionU

FoamFile{

version 2.0;format ascii;

root "";case "";instance "";local "";

class volVectorField;object motionU;

}

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

internalField uniform (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

Page 17: Technical documentation for ICOFSI

0/cellDisplacement

FoamFile{

version 2.0;format ascii;

root "";case "";instance "";local "";

class volVectorField;object cellDisplacement;

}

dimensions [0 1 0 0 0 0 0];

internalField uniform (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

Page 18: Technical documentation for ICOFSI

0/pointDisplacement

Note: calculated from cellDisplacement, hence flexible structure should havecalculated patch.

FoamFile{

version 2.0;format ascii;

root "";case "";instance "";local "";

class pointVectorField;object pointDisplacement;

}

dimensions [0 1 0 0 0 0 0];

internalField uniform (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

Page 19: Technical documentation for ICOFSI

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

Page 20: Technical documentation for ICOFSI

deal.ii/object0.prgm

subsection FEMset The Write Interval = 250set The Order of FE_QGauss = 1set The Order of Gauss Quadrature = 2set The Number of Refinements = 1set The Number of Cycles = 1

end

subsection The Theta Methodset The Theta Coefficient = 0.5

end

subsection BodyForce Constantsset The Gravity = 0

end

subsection Dynamical Constantsset The Alpha Damping Coefficient = 0.0set The Beta Damping Coefficient = 0.0

end

subsection Material Constantsset The Lame Parameter Lambda = 11538000.46set The Lame Parameter Mu = 7692000.31set The Density = 1000.

end

subsection Aitken Relaxation Constantsset The Omega Coefficient = 1.0set The Tolerance Factor = 1e-6

end

deal.ii/marker

The first line presents starting time of evaluate the probes, the number ofprobes. Second line contains the probes coordinates in (x,y,z).

7.06301 31.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 dueto the search function assumes strictly inside [<].

20

Page 21: Technical documentation for ICOFSI

The keywords for dealiiParameterHandler

The following list the parameters where the first name is the subcategorythey placed under. The definitions of reading parameters are in dealiiParameterHandler.

• The Theta Method, The Theta Coefficient, the blending coefficientfor the theta method. Default value is set to Crank-Nicholson (0.5).

• FEM , The Write Interval, the output is written on disk by intervalper iteration. Default is every iteration (0). [inactivated in ICOFSI]

• FEM , The Order of FE QGauss, the order of basis for FEM. Defaultis linear (1).

• FEM , The Order of Gauss Quadrature, the order of Quadrature.Default is under integration (1).

• FEM , The Number of Refinements, the number of refinements.Default is none (0).

• FEM , The Number of Cycles, the number of adaptive refinements.Default is none (0).

• Material Constants, The Lame Parameter Lambda, the lame λ pa-rameter, Default is 0.

• Material Constants, The Lame Parameter Mu, the lame µ param-eter, Default is 0.

• Material Constants, The Density, the density of structure, defaultis 1.

• BodyForce Constans, The Gravity, the gravity, default is 0.

• Dynamical Constants, The Alpha Damping Coefficient, the α inRayleight damping. Default 0.

• Dynamical Constants, The Beta Damping Coefficient, the β inRayleight damping. Default 0.

• Aitkens Relaxation Constants, The Omega Coefficient, the ω inAitkens formula. Default 1.

• Aitkens Relaxation Constants, The Tolerance Coefficient, the ωin Aitkens formula. Default 0.

• OpenFoam To DEAL.II Tolerance Mesh Distance, the thresholddistance from surface of structure.

21

Page 22: Technical documentation for ICOFSI

Gmesh

Here follows a short quote from a forum in how to generate hexahedral meshfor DEAL.II using gmesh utility.

The only algorithms currently available in gmsh that produce hexahedralelements are the transfinite and the extrusion algorithms. See demos/hex.geofor a simple example.

The input to Gmesh is command like specification with a robust GUI.

DEAL.II meshing routine

Alternative procedure is deal.ii own routines, see the dealiiGrid.H to gen-erate the cantilever mesh used in [1],

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 stepdeclaration.

22

Page 23: Technical documentation for ICOFSI

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 functioncell_rhs(i)+=shared::icofsi_db_list[n_object]->get_traction(component_i,cell->face_index(face))*

invrho*fe_face_values.shape_value(i,q_point)*fe_face_values.JxW(q_point);}

Replace the shared :: icofsi db list[n object]− > get traction(component i, cell− >face index(face)) to a specific value or use exact pressure from an Open-Foam calculation.

23