Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views51 pages

Curso B1 introduction2OpenFOAM

Uploaded by

Katumbi Moïse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views51 pages

Curso B1 introduction2OpenFOAM

Uploaded by

Katumbi Moïse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Basic Courses (B1)

INTRODUCTION TO OPENFOAM
open Field Operation And Manipulation
C++ libraries

Name
INTRODUCTION TO OPENFOAM
open Field Operation And Manipulation
C++ libraries

OpenFOAM | Equations | Solvers | How to use/code | Examples | Conclusions

3 25 26 33 46 49 50

Rita F. Carvalho, MARE, Department of Civil Engineering, University of Coimbra, Portugal


OpenFOAM – what it is

SOLVE PARTIAL DIFFERENTIAL EQUATIONS (PDE)

RESOLUTION OF CURRENT “ENGINEERING” CHALLENGES

USE OF ADVANCED TECHNOLOGY

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM – what it is

OpenFOAM is a powerful tool that allows the


 numerical solution of differential equations
 easily code specific problem based on differential equations (continuum mechanics)

OpenFOAM is a software toolbox licensed under the GNU General Public License
trusted by many thousands of engineers and scientists in industry and academia
worldwide.

OpenFOAM is an open source C++ library, prepared to simple or parallel computing to


create executable applications (solvers & utilities) in
solvers designed to solve a specific problem in continuum mechanics
utilities designed to perform tasks that involve data manipulation.

OPENSOURCE, FREE, OPEN CODE, CONTINUOUS EVOLUTION


Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM – how can be used

• Users can use and write simple to complex solver with only few lines
(depending of the knowledge in physics and programming techniques)

• Users can change the existing solvers, and, use them as the start point for
the creation of a new solver - The complete source of the code is available!

• Users can profit from the numeric tools to solve EDPs, laplacian, gradient,
divergent ...

≠ Terms
≠ Equations  ≠ solvers
≠ Set of Equations
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM applications
Multi disciplinar
Mechanics of Fluids, Turbulence, Heat Transfers, Chemical Reactions,
Electromagnetism, Financial

Besides…
 in hydraulic and CFD Fields …
• Aero and hydro dynamics of objects (vehicles, greenhouses, wind towers);
• Dimensioning of hydraulic structures;
• Optimization and design of river and maritime structures;
• Dimensioning of heat transfer devices;
• Influence of wind on structures;
• Propagation of polluting feathers;
• Simulation of sediment transport and location of erosion zones.
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Different versions of OpenFOAM

http://openfoamwiki.net/index.php/Forks_and_Variants#Definitions

• Fork
The idea behind forking is that when several changes to the code are made, the distribution of the
modified group of changes should use a different name from the original project, to avoid confusion,
and should follow the policies and guidelines mentioned above. Fork (software development)

• Variant
This is the denomination mostly used when the changes to the complete source code package
don't seem substantial enough to require a fully dedicated source code branch for supporting the
changes made. This usually occurs for situations where the changes are done only a few times for a
particular version of a software or even when the changes are only provided as patch files.
Nonetheless, these variants must still abide to the policies and guidelines mentioned above.

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Different versions of OpenFOAM

FORKS ‐ number of different flavours of OpenFOAM that are all based on the original FOAM‐code.

• OpenFOAM (Foundation) OpenFOAM by the OpenFOAM foundation


• OpenFOAM+ OpenFOAM+ by the ESI‐OpenCFD
• Foam‐extend Foam‐extend has a number of additional community‐contributed features.
• Other
o Caelus‐CML ‐ version 5.10 (October 2015), it's officially a fork of OpenFOAM 2.1.1 ‐ Hybrid commercial model,
made available freely to the public.
o ENGYS' own builds of OpenFOAM ‐ Available for customers only/ Strictly commercial.
o FreeFOAM ‐ Completely open to the general public. Currently distributed with Debia
o iconCFD ‐ Strictly commercial.
o RapidCFD and RapidCFD @ Sim‐Flow‐ fork of OpenFOAM that has been specifically designed to be built with
CUDA. Current version is a fork from OpenFOAM 2.3.1
o RheologicRemix

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Different versions of OpenFOAM

VERSIONS

• Latest OpenFOAM version: 6 (10th of July 2018)


• Latest Foam-Extend version: 4.0 (22nd of December 2016)
• Latest OpenFOAM+ version: v1812 (20th December 2018)

• OpenFOAM Release
Notes: 6 | 5.0 | 4.1 | 4.0 | 3.0.1 | 3.0.0 | 2.4.0| 2.3.1 | 2.3.0 | 2.2.2 | 2.2.1 | 2.2.0 | 2.1.1 | 2.1.0 | 2.0.1 | 2.0.0 | 1.7.1
| 1.7.0 | 1.6 | 1.5 | 1.4.1 | 1.4 | 1.3 | 1.2 | 1.1 | 1.0
• Foam-extend Release Notes: 4.0 | 3.2 | 3.1 | 3.0
• OpenFOAM+ Release Notes: v1812 | v1806 | v1712 | v1706 | v1612+ | v1606+ | v3.0+
http://openfoamwiki.net/index.php/Main_Page

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Different versions of OpenFOAM - Installation
OpenFOAM

• Linux ‐ Ubuntu
• Windows
• Mac OS

OpenFOAM+ version: v1812

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Structure

The OpenFOAM source code comprises


of four main components:
src: the core OpenFOAM source code;
applications: collections of library
functionality wrapped up into
applications, such as solvers and
utilities;
tutorials: a suite of test cases that
highlight a broad cross‐section of
OpenFOAM's capabilities;
doc: supporting documentation

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Structure

The OpenFOAM source code comprises


of four main components:
src: the core OpenFOAM source code;
applications: collections of library
functionality wrapped up into
applications, such as solvers and
utilities;
tutorials: a suite of test cases that
highlight a broad cross‐section of
OpenFOAM's capabilities;
doc: supporting documentation

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Structure

The OpenFOAM source code comprises


of four main components:
src: the core OpenFOAM source code;
applications: collections of library
functionality wrapped up into
applications, such as solvers and
utilities;
tutorials: a suite of test cases that
highlight a broad cross‐section of
OpenFOAM's capabilities;
doc: supporting documentation

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM – Installation and use

Users want Users should


A “black box” software that they can use with
complete confidence for general problem classes Know what they are using, what is behind software
without having to understand the fine algorithmic
details.
Be sure that they can have confidence in models
to be able to tune data structures for a particular
application, even if the software is not as reliable as Look at data, analyse it and be able to decide if it is trustable
that provided for general methods
Have an idea of what kind of uncertainty is possible in data
to use a large body of numerical software freely
available 24 hours a day via electronic services ‐ there Understand why so different models, solvers, …
are already dozens of libraries, technical reports on
various parallel computers and software, test data,
facilities to automatically translate FORTRAN
programs to C, bibliographies, names and addresses
of scientists and mathematicians, and so on.
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

OpenFOAM contains a suite of numerical tools to solve a range of problems.


To solve equations for a continuum, OpenFOAM uses a numerical approach
with the following features:

1. Segregated, iterative solution:


system of equations governing our problem of interest 
separate matrix equations are created for each equation, and are solved
within an iterative sequence (as opposed to created one, big matrix equation
for the entire system of equations).

2. Finite volume method: Matrix equations are constructed using the finite
volume method applied to arbitrary shaped cells (any number of faces, any
number of edges).
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes
Physical approximations
3
Partial differential Equations, Initial and Boundary Conditions
CFD - Mass, momentum and energy conservation, inlet, outlet, walls,…
Depending of PDE – Physical phenomenon
Calculate Position/Time;
Variables: u, p, T, φ; Properties: 𝜌, 𝜇, 𝑘, 𝜎, Г, c  definition 2
Numerical solution techniques - Consideration of continuous
material/domain represented by discrete particles - Finite volumes, finite
elements  Geometry and Meshing - acceptable element sizes and 1
shapes
 accurate numerical approximations - Implicit Methods, precision,
diffusion, relaxation and accuracy options 4
CFD -Accurate treatment of momentum – advection term, coupling
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes
Involving:
Differential Equations Variables:
dependent and
indepedent, (x,t)
Properties
Domain / material represented as continuous and represented by discrete
particles

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

To solve equations for a continuum, OpenFOAM uses a numerical approach


with the following features:

•Parallel computation are easy to perform (reduction of the computational


time);
•You can create simple meshes with the mesh generator that comes with
OpenFOAM. Also, you can convert to the OpenFOAM format, meshes
created with another software (check the user guide for the available
formats);
•It comes with several utilities;
•All components implemented in library form for easy re-use.
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

OpenFOAM contains a suite of numerical tools to solve a range of problems.


It includes methods to solve problems where matter is represented as a
continuum and where it is represented by discrete particles.
To solve equations for a continuum, OpenFOAM uses numerical approaches

CFD - We replace the actual molecular structure by a hypothetical continuous


medium, which at a point has the mean properties of the molecules
surrounding the point - "fluid particle“ – control volume – imaginary region in
which dynamic forces are in equilibrium - we look at the forces in external
surface of the control volume  integral form of equations/ differential.
 we choose the most convenient in each case

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes
Differential Equations CFD
1  ui ui  ui  p  ji
 0   u j  gi  
 t xi t x j xi x j
Domain / material represented as continuous and represented by discrete
particles
 2 BC

 4 BC  6 BC

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

To solve equations for a continuum, OpenFOAM uses a numerical approach


with the following features:

Collocated variables: The solution variable for each matrix equation is defined
at cell centres.

Different discretization schemes It uses second order schemes for the


approximation of the different operators, but, many schemes are available,
including high order schemes;

Equation coupling: The coupling between equations, particularly pressure and


velocity is performed using adapted versions of well-known algorithms such
as e.g. PISO and SIMPLE  PIMPLE
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes
We assume the fluid is continuous, the continuum
hypothesis represented by discrete volumes with
average Properties

Density
Surface Tension
Bulk modulus / Compressibility
Diffusivity coefficient (spontaneous spreading of matter )
Viscosity (random motion comes from the molecular
natures of the constituents)

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes
General Equations – PDE ‐ OpenFoam
Partial D.Equations
•Mesh Pre ‐ processor
•Properties
•Initial and Boundary Conditions
•Parameters, controls and options
Solver
•Solve the equation
Gradients/divergents/ laplacians/interpolation

•Results analysis Post‐ processor

http://www.cfd‐online.com/
http://www.openfoam.com/

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Use

Pre‐Processor Solver Post‐Processor

Utilities Meshes applications softwares

• Pre‐Processor
Mesh Utilities
IC + BC
Properties & parameters
Dictionary
• Solver
• Post‐Processor
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Equations

Equations in a solver Laplacian vector


Divergent vector Gradient scalar
(gradient of a divergent)
𝛻 · 𝜙𝑈 ‐ 𝛻 · 𝜇𝛻𝑈 𝛻𝑝  scalar
 vector
 vector
u v w  2u  2 v  2 w p p ˆ p ˆ
.V    V 2 2 2
2 p  î j k
x y z x y z x y z
Ex: Solve (
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(miu, U)
== - fvc::grad(p)
);
it is fundamentally a tool for solving partial differential equations rather than a
CFD package in the traditional sense
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Laplacian vector
(gradient of a divergent)
OpenFOAM - Solvers  vector
 2u  2 v  2 w
 2V   
Basic’ solvers x 2 y 2 z 2

laplacianFoam/ overLaplacianDyMFoam Solves a simple


Laplace equation, e.g. for thermal diffusion in a solid T[K] is the absolute
temperature field,
fvScalarMatrix TEqn
𝛻 · 𝛼𝛻𝑇 , α (
ρ[kg/m3] is the density
fvm::ddt(T) – field, q[W/m3] is the rate
of energy generation per
𝑇 𝛼𝛻 𝑇 thermal diffusivity 𝛼 is represented by DT fvm::laplacian(DT, T) unit volume, α [m2/s] is
== the thermal diffusivity,
 Initial and BC k[W/(m⋅K)] is the
fvOptions(T)
thermal conductivity
ddtSchemes laplacianSchemes );
and cp[J/(kg⋅K)] is the
specific heat at constant
 fvSolution, fvSchemes pressure
interpolationSchemes
gradSchemes, divSchemes, snGradSchemes
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Laplacian vector
(gradient of a divergent)
OpenFOAM - Solvers  vector
 2u  2 v  2 w
 2V   
Basic’ solvers x 2 y 2 z 2
ofv6:
laplacianFoam Solves a simple Laplace equation,
. /opt/OpenFOAM/of6_envars.sh
e.g. for thermal diffusion in a solid
v1812:
𝛻 · 𝛼𝛻𝑇 , α . /opt/foam/of+1812_envars.sh
Lookfor:
Pre‐Processor cd $FOAM_RUN/tutorials/
T: internal and boundary field; /laplacianFoam/flange
transportProperties : DT 4e‐05; See: 0, constant, system
ControlDict, fvSchemes, fvSolution
Mesh and Solver
ansysToFoam (create polyMesh in constant)… laplacianFoam
Post‐Processor: paraView
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

Basic’ solvers
scalarTransportFoam Solves a transport equation for a passive scalar (scalar
convection-diffusion problem on a given velocity field.) Pre‐Processor
ex:pitzDaily 0: U, T
solve ( fvm::ddt(T) + constant: transportProperties
𝛻 · ϕ𝑇 𝛻 · 𝛼𝛻 𝑇 𝑆 fvm::div(phi, T) - System: blockMeshDict,
IBC - Mandatory fields: fvm::laplacian(DT, T) controlDict,
•U: velocity [m/s] = ϕ ); fvSchemes, fvSolutiojn
•T: scalar [-] Mesh
blockMesh (blockMeshDict)
Solver: scalarTransportFoam
Post‐Processor: paraView
potentialFoam Simple potential flow solver which can be used to generate
starting fields for full Navier-Stokes codes;
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

Solvers capabilities
Incompressible
Compressible
Multiphase
Combustion
DNS and LES
lagrangian
Particle-tracking flows
Conjugate Heat transfer …
Buoyancy-driven flows

Particle methods (DEM, DSMC, MD)


Other (Solid dynamics, electromagnetics)
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

Standard Solvers
Incompressible flow adjointShapeOptimizationFoam Compressible flow
boundaryFoam rhoCentralFoam
channelFoam
rhoCentralDyMFoam
icoFoam
rhoPimpleFoam
MRFSimpleFoam
rhoPorousMRFLTSPimpleFoam
nonNewtonianIcoFoam
pimpleDyMFoam rhoPorousMRFSimpleFoam
pimpleFoam rhoPorousMRFPimpleFoam
pisoFoam rhoSimplecFoam
porousSimpleFoam rhoSimpleFoam
shallowWaterFoam sonicDyMFoam
simpleFoam sonicFoam
SRFSimpleFoam
sonicLiquidFoam
windSimpleFoam
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

Standard Solvers bubbleFoam


multiphase flow cavitatingFoam combustion
compressibleInterFoam
interFoam chemFoam
interDyMFoam coldEngineFoam
interMixingFoam dieselEngineFoam
interPhaseChangeFoam dieselFoam
LTSInterFoam
engineFoam
MRFInterFoam
fireFoam
MRFMultiphaseInterFoam
multiphaseInterFoam
PDRFoam
porousInterFoam reactingFoam
settlingFoam rhoReactingFoam
twoLiquidMixingFoam XiFoam
twoPhaseEulerFoam
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Notes

Standard Solvers
Particle-tracking flow

coalChemistryFoam
icoUncoupledKinematicParcelDyMFoam
icoUncoupledKinematicParcelFoam
LTSReactingParcelFoam
porousExplicitSourceReactingParcelFoam
reactingParcelFilmFoam Direct simulation Monte Carlo methods
reactingParcelFoam
uncoupledKinematicParcelFoam dsmcFoam Direct simulation Monte Carlo
(DSMC) solver for 3D, transient,
multi‐ species flows

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


Pre‐Processor:
OpenFOAM - Use Mesh (1), IC (3) +BC(1),Prop (2),
Parameters (4)
• files
Solver  choice

1.
blockMesh (blockMeshDict in system folder)
cartesianMesh (MeshDict in system folder+stl in example)
snappyHexMesh ‐ snappyHexMeshDict in system folder
ANSYS ‐ ficheiro X.ans na pasta + ansysToFoam

4. Parameters,Solver
2. P

3.
IBC

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
blockMesh
OpenFOAM - Use icoFoam
paraFoam
CFD – Open‐Foam 1.
Follow an example ‐ laminar incompressible cavity blockMesh (blockMeshDict in system folder)
Change to directory of the example data
 dictionary blockMeshDict– blockMesh
u
topview

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
OpenFOAM - Use 2. P

CFD – Open‐Foam
Follow an example ‐ laminar incompressible
cavity
Change to directory of the example data
 dictionary blockMeshDict– blockMesh
 verify other files if needed:
Properties (depend from solver) and
choice of parameters and solvers
(icoFoam)
IBC

3.
IBC

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
OpenFOAM - Use 4. Parameters,Solver

CFD – Open‐Foam
Follow an example ‐ laminar incompressible
cavity ddtSchemes
{ default Euler;}
Change to directory of the example data gradSchemes
{ default Gauss linear;
 dictionary blockMeshDict– blockMesh grad(p) Gauss linear;}
divSchemes
 verify other files if needed: IBC { default none;
div(phi,U) Gauss linear;}
Properties (depend from solver) and laplacianSchemes
{ default none;
choice of parameters and solvers laplacian(nu,U)
Gauss linear corrected;
(icoFoam) laplacian((1|A(U)),p)
Gauss linear corrected;}
interpolationSchemes
{ default linear;
interpolate(HbyA) linear;}
snGradSchemes
{ default corrected;}
fluxRequired
{ default no;
p ;}

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Use 1.
blockMesh (blockMeshDict in system folder)
• Create a new example
• New folder with 3 subfolders • Always 3D
• First in OpenFOAM is “0” and not “1”
• ConvertToMeters/ vertices / blocks / …
vertices
(
mkdir (nome do problema) convertToMeters 0.001;
(0 0 0)
cd (nome do problema) (1 0 0)
mkdir 0 (1 1 0)
(0 1 0)
mkdir constant

mkdir system );
cd constant
cp –r …
• Through home folder use copy paste for
the chosen solver ‐ interFoam
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Use 1.
blockMesh (blockMeshDict in system folder)
• Create a new example
• New folder with 3 subfolders

• blocks blocks
• …/ edges (linear edges can be omitted) ‐ (
NOTA: non linear edge defined by 2 vertices followed hex (0 1 2 3 4 5 6 7) (100 50
by 2 or more interpolation points 25) simpleGrading (1 2 3)
• Arc (arc center), );
edges • simpleSpline (int.p.)
( • polyLine (int.p.) simpleGrading (1 2 3)
Arc 1 5 (2.0 ‐1.0 0.2)
• polySpline (int.p.) edgeGrading (1 1 1 1 2 2 2 2 3 3 3 3)
);
• Line (0)
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM - Use 1.
blockMesh (blockMeshDict in system folder)
• Create a new example
• New folder with 3 subfolders patches
(
left
{
type cyclic;
neighbourPatch right;
• …/patch faces ((0 4 7 3));
}
inlet (0 4 7 3); outlet(1 2 6 5); right
walls (0 1 5 4),(0 3 2 1),(3 7 6 2),(4 5 6 7) {
type cyclic;
patches neighbourPatch left;
( patch inlet ( (0 3 7 4)) faces ((1 5 6 2));
patch outlet ( (1 5 6 2)) }
wall wall ( (0 1 2 3) (0 4 5 1) (2 6 7 3) (4 7 6 5))); );
mergePatchPairs();
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
blockMesh
OpenFOAM - Use icoFoam
paraFoam
CFD – Open‐Foam 1.
Follow an example ‐ laminar incompressible cavity Salome to do the geometry and stl files
Change to directory of the example data Use surfaceFeatureEdges and MeshDict
 dictionary blockMeshDict– blockMesh


File produced by Nazmul Beg
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


2. P Properties (depends from solver)
OpenFOAM - Use g
transportProperties
turbulenceProperties
• Create a new exemple: RASProperties
LESProperties
environmentalProperties
waveProperties
MRFZones

3.
IBC
0 – Define BC – boundaries should be
defined by patch accordingly
physical properties

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


cd $FOAM_RUN/tutorials/incompressible/icoFoam/cavity
OpenFOAM - Use 3.
IBC
CFD – Open‐Foam
Follow an example ‐ laminar incompressible
cavity
Change to directory of the example data
 dictionary blockMeshDict– blockMesh
 verify other files if needed:
Properties (depend from solver) and
choice of parameters and solvers
(icoFoam)
IBC – Initial conditions through setFields

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


4. Parameters,Solver
OpenFOAM - Use

• Create a new exemple:

• fvScheme ‐Define the


approximations for the operators
• fvSolution ‐ Define how to solve
the system of equations

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


4. Parameters,Solver
OpenFOAM - Use CFD – Open‐Foam
‐ Other functions to include variable boundaries:
• Create a new exemple: swak4foam

Others dictionaries
» controlDict
» setFieldsDict
 controlDict » topoSetDict
libs ( » refinemeshDict
"libswakFunctionObjects.so"
» decomposeParDict
"libsimpleFunctionObjects.so"
"libgroovyBC.so"
);

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


4. Run diferente meshes – usually 3
OpenFOAM - Use CFD – Open‐Foam
CFD – Open‐Foam
Follow an example ‐ laminar
incompressible cavity
Change to directory of the example
data
 dictionary blockMeshDict–
blockMesh
 verify other files if needed:
Properties (depend from solver)
and choice of parameters and
solvers (icoFoam)
IBC – Initial conditions through
setFields
 Try to change mesh – look at
resuts and parameters
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


EXAMPLES: Roughness Channel / Hydraulic Jump
EXAMPLE: Industrial building

Concentração de químico
8 ‐10 ppm

5 – 8 ppm

1 – 5 ppm

Model constructed by Pedro Lopes


EXAMPLE: Municipal swimming-pool
Velocidade Máxima = 3.43 m/s
Velocidade Média = 0.22 m/s Temperatura Média = 24.4ºC
Velocidade Mínima = 0.0002 m/s

Model constructed by Pedro Lopes


EXAMPLE: Other hydraulic aplications

https://www.youtube.com/watch?v=gJBsgdNTRDw&list=PL6BfJWHH53_pLUOzU8uuzXgvrhR6uBAR6&index=4
https://www.youtube.com/watch?v=Q6XyTrhaGxc&list=PL6BfJWHH53_pLUOzU8uuzXgvrhR6uBAR6&index=7
https://www.youtube.com/watch?v=6Wc2lJ4N‐2s&list=PL6BfJWHH53_pLUOzU8uuzXgvrhR6uBAR6&index=9
https://www.youtube.com/watch?v=6Wc2lJ4N‐2s&list=PL6BfJWHH53_pLUOzU8uuzXgvrhR6uBAR6&index=9
https://www.youtube.com/watch?v=bR3rulCQS08&list=PL6BfJWHH53_pLUOzU8uuzXgvrhR6uBAR6&index=11

https://www.youtube.com/watch?v=OH0l5CkY_aY
https://www.youtube.com/watch?v=Ky7Ksdf9ihs
https://www.youtube.com/watch?v=SCQL57wHVq4&index=4&list=PL6BfJWHH53_pNtHuG0JAEGsW7WzteQbsL

https://www.youtube.com/watch?v=FhkGIa8J9b0
OpenFOAM – Conclusions

What is openFoam
Applications
Current Forks and versions
Structure and Organization
what is behind software
Main Characteristics, from equations to Pre-processing mesh, properties, options,
choose a solver and see results
Equations in a Solver and code
Basic Solvers: LaplacianFoam, scalarTransportFoam
Other Solvers
Prepare a case: ideas of mesh construction; properties, IBC, options
Understand the importance of fvScheme (approximations for the operators) and
fvSolution (solve the system of equations)
Understand the importance of study a mesh
Examples and Potential of OpenFoam
Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions


OpenFOAM – Next Basic Courses

Basic Meshing Wagner Galuppo (11:30-13:00)

Post-processing Célio Fernandes (14-15:30)

Multi-phase flows József Nagy (16-17:30)

Rita F. de Carvalho

FOAM@IBERIA 2019 OpenFOAM | Equations | Solvers | How to use | Examples | Conclusions

You might also like