Sie sind auf Seite 1von 25

Introductory OpenFOAM Course

From 11th to 15th July, 2016

University of Genoa, DICCA


Dipartimento di Ingegneria Civile, Chimica e Ambientale
These lectures notes are licensed under the Creative Commons
Attribution-ShareAlike 4.0 International License.

To view a copy of this license, visit


http://creativecommons.org/licenses/by-sa/4.0/
Disclaimer

This offering is not approved or


endorsed by OpenCFD Limited, the
producer of the OpenFOAM software
and owner of the OPENFOAM and
OpenCFD trade marks.
Disclaimer

Wolf Dynamics makes no warranty, express or implied, about the completeness,


accuracy, reliability, suitability, or usefulness of the information disclosed in this
training material. This training material is intended to provide general information
only. Any reliance the final user place on this training material is therefore strictly
at his/her own risk. Under no circumstances and under no legal theory shall Wolf
Dynamics be liable for any loss, damage or injury, arising directly or indirectly from
the use or misuse of the information contained in this training material.

Revision 1-2016
Acknowledgements
This training material and tutorials are based upon personal experience, OpenFOAM
source code, OpenFOAM user guide, OpenFOAM programmers guide, and
presentations from previous OpenFOAM training sessions and OpenFOAM
workshops.

We gratefully acknowledge the following OpenFOAM users for sharing online their
material or for giving us their consent to use their material:

Henry Weller and Chris Greenshields, The OpenFOAM Foundation.


Hrvoje Jasak and Henrik Rusche, Wikki Ltd.
Eugene de Villiers, Paolo Geremia, and Dan Combest, Engys.
Hakan Nilsson. Department of Applied Mechanics, Chalmers University of
Technology.
Eric Paterson. Applied Research Laboratory Professor of Mechanical
Engineering, Pennsylvania State University.
Gavin Tabor. College of Engineering, Mathematics and Physical Sciences,
University of Exeter.
Fumiya Nozaki. CFD engineer, Yokohama, Japan.
On the training material
The following typographical conventions are used in this
training material

Courier new
Indicates Linux commands that should be typed literally by the
user in the terminal
Courier new bold
Indicates directories
Courier new italic
Indicates human readable files or ascii files
Arial bold
Indicates program elements such as variables, function names,
classes, databases, data types, environment variables,
statements and keywords. They also highlight important
information
Arial underline in blue
Indicates URLs and email addresses
On the training material
The following typographical conventions are used in this
training material
Large code listing or ascii files listing can be written in a square box, as
follows:

1 #include <iostream>
2 using namespace std;
3
4 // main() is where program execution begins. It is the main function.
5 // Every program in c++ must have this main function declared
6
7 int main ()
8 {
9 cout << "Hello world"; //prints Hello world
10 return 0; //returns nothing
11 }

To improve readability, the text might be colored.


The font can be Courier new or Arial bold.
And when required, the line number will be shown.
On the training material
The following typographical conventions are used in this
training material

This icon indicates a warning or a caution

This icon indicates a tip, suggestion, or a general note

This icon indicates that more information is available in the


referred location

This icon indicates a folder or directory

This icon indicates an ascii file

This symbol indicates that a Linux command should be typed


$> literally by the user in the terminal

This icon indicates that the figure is an animation (animated gif)


On the training material
Training material
In the USB key you will find all the training material (tutorials, slides, quick reference guides, OpenFOAM
user guide, OpenFOAM programmers manual, and lectures notes).

You can extract the training material wherever you want. However, we highly recommend you to extract all the
training material in your OpenFOAM user directory. From now on, this directory will become,
$PTOFC
(abbreviation of Path To OpenFOAM Course)

From now on and whenever you read $PTOFC, it is referring to the location where you extracted the training
material.

You can add an alias to $PTOFC in your .bashrc file by adding the following line,
alias PTOFC=cd PATH_TO_TUTORIALS

To uncompress the tutorials go to the directory where you copied the training material and then type in the
terminal,
$> tar zxvf file_name.tar.gz

A word of caution, use the tutorials included in the training material just for recreational, instructional,
or learning purposes and not for validation, benchmarking or as standard practices.
Housekeeping issues
What OpenFOAM version are we going to use?

During this training we are going to use OpenFOAM version


3.0.1 or 3.0.x.

The one developed by OpenCFD Ltd


(http://www.openfoam.org/)
Housekeeping issues
What Linux flavor should I use?

Personally speaking, we use OpenSUSE but you are free to use


any Linux flavor.

In the workstations you will find an installation of OpenSUSE


Leap 42.1

By the way, if you are using Ubuntu, I will not be able to help
you (I hate it).
Housekeeping issues
What Linux flavor should I use?
For those working on their own computers.
First at all and in order to avoid compatibility issues during the course, we
highly advise you to install our custom made Linux version. You can find it
here:
https://susestudio.com/a/XrxjaO/joel-s-opensuse-leap-42-1-kde-4-desktop
A virtual machine distribution and an ISO distribution are available for
download.
We also remind you that it is a fully working Linux OpenSUSE Leap 43.1
version (with KDE 4), that you can modify or upgrade to fit your needs.
So if you do not like KDE, you can install Gnome or whatever you want to
use.
If for any reason you do not want to use our Linux version, you are free to
install any Linux version you like.
Housekeeping issues
What Linux flavor should I use?
Our custom made Linux version was created with CFD applications in mind
for CFD users. It comes with many CFD, CAD, mesh generation,
visualization, numerical libraries, optimization, plotting applications and
editing utilities pre-installed. It also comes with all the compilers and
libraries necessary to compile most of the applications.
In the version available for download you have all the applications necessary
to follow this course.
By the way, in my personal copy I have many multi-physics, CFD, FEA,
CAD, multibody dynamics, visualization, numerical libraries, meshing,
scientific computing, python and developing applications installed.
The OpenFOAM version installed is 3.0.x, which you can update by using
the Git revision control system.
Housekeeping issues
Installing OpenFOAM - Working on your own
If for any reason you do not want to use our Linux version, you are free to
install any Linux version you like.

To install OpenFOAM, just follow the instructions given in


http://www.openfoam.org/

If for any reason the instructions given in http://www.openfoam.org/ do not


work for you, you can use our instructions. They work fine with Linux
OpenSUSE 12.3 or newer versions.

You can find out instructions in the supplement slides.

Our instructions are exactly the same as the one you will find in
http://www.openfoam.org/, we only added a few tips and comments.
Housekeeping issues
What Linux shell should I use?
During this training we are going to use the BASH shell. If you want to know what
shell you are using, type in the terminal

$> echo $SHELL

If the output is: /bin/bash, you are using BASH shell.

If your output is something else, you are not using BASH shell. In this case, to start
using BASH shell you can type in the terminal,

$> bash

If you do not know what is the terminal, do not worry we are going to talk about it in a
few minutes.
Housekeeping issues
A few questions before we begin

Who does not have a working installation of


OpenFOAM?

And I hope not to see hands up.


Housekeeping issues
A few questions before we begin

What about your OpenFOAM skills?

Totally new.

Beginner.

Intermediate.

Advanced.

Guru.
Housekeeping issues
A few questions before we begin

Any clue on the FVM, CFD, multi-physics


simulations, scientific computing, or numerical
methods?

Not a clue.

I know two or three things.

Snug as a bug in a rug.

Guitar hero.
Housekeeping issues
A few questions before we begin

How confortable are you with Linux?


If you are new to Linux, do not worry, we are going to give you a crash
introduction to the basic Linux commands.

Also, if you installed our Linux version, we are going to show how to use
it and what applications are installed.

In the following link, you will find an excellent introduction to the Linux
command line (or terminal):

http://linuxcommand.org/

In the same link, there is an excellent book for download. We highly


recommend you to read it if you want to improve your Linux and shell
scripting skills.
Housekeeping issues
You are in Linux, you see this nice window that
everybody calls terminal. Now what?
Training agenda
Module 0.
Training agenda
On the training material
Housekeeping issues
Additional information

Module 1.
Introduction to OpenFOAM
A few OpenFOAM simulations
Library organization
OpenFOAM 101 My first tutorial

Module 2.
CFD workflow
Geometry generation using open source tools
Getting more productive using a GUI
Training agenda
Module 3.
Meshing preliminaries
Mesh quality assessment
Mesh conversion and manipulation
Meshing in OpenFOAM
Meshing with cfMesh
Meshing with open-source tools

Module 4.
Scientific visualization
Post-processing and plotting
Co-processing
Scripting
Data analytics

Module 5.
Running in parallel
GPU
Training agenda
Module 6.
The finite volume method. A crash introduction
On the CFL number
Boundary conditions and initial conditions
Unsteady and steady simulations
Assessing convergence
Velocity pressure-coupling
Linear solvers

Module 7.
Programming in OpenFOAM - Building blocks
Programming in OpenFOAM - Implementing/modifying applications
Programming in OpenFOAM - Implementing boundary conditions, initial conditions
and utilities
Programming in OpenFOAM - CodeStream
Implementing boundary conditions using swak4foam
Field initialization using swak4foam
Interpolating experimental values using setDiscreteFields
Training agenda
Module 8.
Advanced modeling capabilities:
Turbulence modeling
Multiphase flows
Source terms
Moving reference frames and sliding grids
Moving bodies and rigid body motion
Adaptive mesh refinement
Heat-transfer and conjugate heat transfer
Discrete particle modeling

Module 9.
Tips and tricks

Module 10.
Conclusions and wrap-up session
Afternoon Session Morning Session
(1:30 pm 5:00 pm) (9:00 am 12:30 am)

Running my first OpenFOAM case. Before we start - Housekeeping issues.


Setting cases in OpenFOAM. Choosing Introduction - Overview of OpenFOAM.
boundary conditions, initial conditions, and Physical models, solvers and utilities.
physical models. Library organization and code structure.
Selecting solver parameters. Running my first OpenFOAM case.
Day 1

Controlling solution behavior and solution Introduction to post-processing and scientific


monitoring. visualization with paraFoam.

CFD simulation lifecycle.


Meshing preliminaries.
Running in parallel.
Assessing mesh quality.
Finite Volume Discretization: theoretical
Mesh generation using OpenFOAM technolgy.
background.
Introduction to blockMesh and snappyHexMesh.
How to choose the right numerics.
Meshing in parallel.
Day 2

Getting convergence from scratch.


Meshing tutorials using OpenFOAM technolgy.
Hans-on session.
Hands-on session.

Scientific visualization using paraFoam.


More on geometry generation, mesh generation, Sampling, function objects and co-processing in
and post-processing using OpenFOAM OpenFOAM.
technolgy and open source tools. Python scripting, shell scripting and automation.
Setup a case from scratch. The real deal. Geometry generation, mesh generation and
Day 3

Hands-on session. post-processing using Open Source tools.

(5:00 pm 5:30 pm)


Social dinner later tonight. Hands-on session.

More on modifying OpenFOAM solvers, Basics of C++ programming.


utilities and boundary conditions. Programming in OpenFOAM: building blocks.
More on implementing boundary and initial OpenFOAM solvers: brief overview and
conditions using external libraries. walkthrough.
Advanced physical modeling capabilities. Modifying OpenFOAM solvers, utilities and
Multiphase flows, turbulence modeling (RANS boundary conditions.
Day 4
Training agenda

and LES), moving bodies, sliding grids and Implementing boundary and initial conditions
MRF. using external libraries.
Provisional timetable

End of the day. Last minute issues and additional questions.

Hands-on session. Hands-on session.

More on advanced physical modeling


capabilities. Multiphase flows, turbulence
Wrap-up session. modeling (RANS and LES), moving bodies,
Open discussion: questions, doubts and sliding grids and MRF.
attendees own cases. OpenFOAM documentation.
Day 5

Brief overview on optimization using DAKOTA.


Hands-on session.
The above outline is a guide only and every attempt will be made to adjust the course content to suit the needs of the attendees

Das könnte Ihnen auch gefallen