Professional Documents
Culture Documents
OpenFOAM2015 16
OpenFOAM2015 16
Introduction
Speakers:
Francois Rigo
Francois.Rigo@student.ulg.ac.be
Jos Rothkegel
ji.rothkegel@ulg.ac.be
Amandine GUISSART
amandine.guissart@ulg.ac.be
February 2016
OpenFoam
What's OpenFOAM?
OpenFOAM: Open source Field Operation And
Manipulation
C++ toolbox for the development of customized
numerical solvers, and pre-/post-processing utilities
for the solution of continuum mechanics problems,
including computational fluid dynamics (CFD).
OpenFoam
Ubuntu Login
User: foam
Pass: catia1135
Linux Basics
Open Terminal:
In gnome 2.x:
Applications Accesories Terminal
In KDE 4.x:
Applications menu Systems Konsole
Linux Basics
Create Folder
~$mkdir name
Copy files
~$cp name destination
Delete files(attention: no undelete option)
~$rm name
Rename file
~$mv name_original name_new
Change directory
~$cd folder
Go to home directory
~$cd
Go to cavity_original folder
~$cd cavity_original
OpenFOAM Basics
Folder structure
OpenFOAM Basics
blockMeshDict
convertToMeters 0.1;
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
);
OpenFOAM Basics
blockMeshDict
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)
);
OpenFOAM Basics
blockMeshDict ...
boundary frontAndBack
( {
movingWall type empty;
{ faces
type wall; (
faces (0 3 2 1)
( (4 5 6 7)
(3 7 6 2) );
); }
} );
fixedWalls
{
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
);
}
...
OpenFOAM Basics
In paraFoam:
a) Apply in the Object Inspector
b) Surface With edges in the representation menu
a
OpenFOAM Basics
Problem set-up
Initial values: Folder 0
U
p
Properties: Folder constant
TransportProperties
Numerical Control: Folder system
controlDict
fvSchemes
fvSolution
OpenFOAM Basics
File: p
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
movingWall
{
type zeroGradient;
}
fixedWalls
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
OpenFOAM Basics
File: U
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
movingWall
{
type fixedValue;
value uniform (1 0 0);
}
fixedWalls
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
OpenFOAM Basics
File: U
For external flows
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
dummyWall
{
type freestream;
freestreamValue uniform (1 0 0);
}
}
OpenFOAM Basics
File: transportProperties
nu [ 0 2 -1 0 0 0 0 ] 0.01;
OpenFOAM Basics
File: controlDict
application icoFoam; t|U|
CFL=
startFrom startTime; x
startTime 0;
stopAt endTime;
endTime 0.5;
DeltaT 0.005; // CFL is imposed through t
writeControl timeStep;
writeInterval 20;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
OpenFOAM Basics
a
paraFoam Basics
c d
b
paraFoam Basics
Common toolbar
Mesh Grading
Problem is based on the lid-driven cavity tutorial
It introduces the mesh grading feature
Student Work
Build mesh
~$blockMesh
Run the files:
~$icoFoam
View the results:
~$paraFoam
OpenFOAM Integrals
To calculate forces
controlDict
...
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
#include "forceCoeffs"
}
OpenFOAM Integrals
To calculate forces
forceCoeffs
Adapted from
tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v3.0+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
forceCoeffs1
{ 2 FL
type forceCoeffs; C L=
functionObjectLibs ( "libforces.so" ); U 2 A
outputControl timeStep; 2 FD
timeInterval 1; C D=
log yes; U 2 A
patches ( patchesName );
rhoName rhoInf; // Indicates incompressible
rhoInf 1; // Redundant for incompressible
liftDir (0 0 1);
dragDir (1 0 0);
CofR (1 0 0); // Axle midpoint on ground
pitchAxis (0 1 0);
magUInf 20;
lRef 1.0; // Reference length
Aref 1.0; // Reference Area
}
Linux
Just google:linux commands
OpenFOAM
OpenFoam User Guide
Installing OpenFOAM
http://www.openfoam.com/version-v3.0+/