Curso B1 introduction2OpenFOAM
Curso B1 introduction2OpenFOAM
INTRODUCTION TO OPENFOAM
open Field Operation And Manipulation
C++ libraries
Name
INTRODUCTION TO OPENFOAM
open Field Operation And Manipulation
C++ libraries
3 25 26 33 46 49 50
Rita F. de Carvalho
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.
• 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
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
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
FORKS ‐ number of different flavours of OpenFOAM that are all based on the original FOAM‐code.
Rita F. de Carvalho
VERSIONS
• 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
• Linux ‐ Ubuntu
• Windows
• Mac OS
Rita F. de Carvalho
Rita F. de Carvalho
Rita F. de Carvalho
Rita F. de Carvalho
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
Rita F. de Carvalho
Rita F. de Carvalho
4 BC 6 BC
Rita F. de Carvalho
Collocated variables: The solution variable for each matrix equation is defined
at cell centres.
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
http://www.cfd‐online.com/
http://www.openfoam.com/
Rita F. de Carvalho
• Pre‐Processor
Mesh Utilities
IC + BC
Properties & parameters
Dictionary
• Solver
• Post‐Processor
Rita F. de Carvalho
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
Solvers capabilities
Incompressible
Compressible
Multiphase
Combustion
DNS and LES
lagrangian
Particle-tracking flows
Conjugate Heat transfer …
Buoyancy-driven flows
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
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
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
Rita F. de Carvalho
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
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
• 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
…
File produced by Nazmul Beg
Rita F. de Carvalho
3.
IBC
0 – Define BC – boundaries should be
defined by patch accordingly
physical properties
Rita F. de Carvalho
Rita F. de Carvalho
Rita F. de Carvalho
Others dictionaries
» controlDict
» setFieldsDict
controlDict » topoSetDict
libs ( » refinemeshDict
"libswakFunctionObjects.so"
» decomposeParDict
"libsimpleFunctionObjects.so"
"libgroovyBC.so"
);
Rita F. de Carvalho
Concentração de químico
8 ‐10 ppm
5 – 8 ppm
1 – 5 ppm
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
Rita F. de Carvalho