openfoam – opensource and cfd - department of...
TRANSCRIPT
![Page 1: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/1.jpg)
OpenFOAM – Opensource and CFD
Andrew KingDepartment of Mechanical EngineeringCurtin University
![Page 2: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/2.jpg)
Outline
● What is Opensource Software ● OpenFOAM – Overview
– Utilities, Libraries and Solvers
– Data Formats
● The CFD ‘toolchain’– Solid Modelling (Geometry)
– Meshing
– Solution
– Postprocessing
![Page 3: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/3.jpg)
Outline
● Examples– Lid driven Cavity
– Buoyancy driven flow
– Free Surface Flows
– Dynamic Meshing
– Fluid Structure Interaction
![Page 4: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/4.jpg)
Opensource – what is it?
Opensource Software ● has source code freely available.● permits users to study, change, and improve
the code.● allows redistribution in modified or unmodified
form.● promotes development in a public, collaborative
manner.
![Page 5: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/5.jpg)
Examples● Apache (web server) – runs ~60% of the internet● Linux – Operating System based on UNIX.● Firefox – Standards Compliant Web Browser● ...many more ....
And of course
● – Open source CFD
![Page 6: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/6.jpg)
OpenFOAM - Overview
● OpenFOAM stands for: ‘Open Field Operations And Manipulation’
● Consists of a library of efficient CFD related C++ modules.
● These can be combined together to create– solvers
– utilities (for example pre/post-processing, mesh checking, manipulation, conversion, etc.)
● Or, additional functionality can be introduced through new libraries or modules
![Page 7: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/7.jpg)
OpenFOAM - Overview
● So far modules, libraries and applications are available for the following tasks
SOLVERS
’Basic’ CFD Incompressible flows Compressible flows Multiphase flows DNS and LES Combustion Heat transfer Electromagnetics Solid dynamics Finance
UTILITIES
Pre-processing The FoamX case manager Other pre-processing utilities
Post-processing The paraFoam post-processor Third-party post-processing Other post-processing utilities
Mesh processing Mesh generation Mesh converters Mesh manipulation
LIBRARIES
Model libraries Turbulence Large-eddy simulation (LES) Transport models Thermophysical models Lagrangian particle tracking Chemical kinetics
Other features Linear system solvers ODE system solvers Parallel computing Mesh motion Numerical method
● More details of solvers later....
![Page 8: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/8.jpg)
OpenFOAM - Overview
● Data Formats– Open foam cases consist of a directory, and
subdirectories with specific tasks.Top Level Case Directory
Initial Conditions
Timestep Data
Constant Data (fluid properties, etc)
Simulation controls (disc. schemes, solvers, Timestep size, write controls, ... )
Exported Data (ie. VTK format)
Mesh (also in each TS dir for moving meshes)
![Page 9: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/9.jpg)
OpenFOAM - Overview● A GUI (FoamX) allows easy access to the files, to
control all facets, and run simulations.
FoamX GUI
![Page 10: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/10.jpg)
OpenFOAM - Overview
● Alternatively direct access to files is possible– Boundary and initial conditions are set in '0' directory.
file '.../cavity/0/U' – Velocities
Note that OpenFOAM keeps track of dimensions and type (ie scalar, vector, tensor) and checks these when compiling a solver.
Initial internal field values
boundary type and value (where required)
![Page 11: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/11.jpg)
OpenFOAM - Overview
file '.../cavity/0/p' – Pressures
dimensions (ie m2/s2 = N/m2)
Initial internal field values
boundary type (zero normal gradient, no value req’d)
pressure is a scalar
![Page 12: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/12.jpg)
OpenFOAM - Overview
● Postprocessing– Quantitative data available using utility applications,
ie. ● sampleSurface● patchAverage● patchIntegrate● wallHeatFlux● checkYPlus● wallGradU● etc...
– Or from paraFoam graphical utility
![Page 13: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/13.jpg)
OpenFOAM - Overview
● ParaFoam
ParaFoam imports fields in general formats and filters are applied to construct contours, graphs, etc.
Grid visualisation (above) and overlay of pressure contours, velocity vectors and grid (right)
![Page 14: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/14.jpg)
Opensource CFD ‘Toolchain’
● OpenFOAM provides the solver (and a bit more), however the CFD tool chain is more than this.
● It is possible to use an entirely OSS toolchain, or a combination of commercial and OSS tools.
Geometry
Mesh
Solver
Postprocessing
![Page 15: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/15.jpg)
Opensource CFD ‘Toolchain’
Geometry Meshing Solver Postprocessing
Blender
BRL-CAD
SolidWorks
ANSYS Mesh
Gambit
BlockMesh
netgen
gmshOpenFOAM
Utilities
Paraview
OpenDX
ANSYS
FLUENT
TecPlot
OtherOther Other
OpenFOAM Opensource Commercial
![Page 16: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/16.jpg)
Customisation
● Due to opensource code, customisation is easy.● for solvers, a typical flow equation can be
descibed as follows. (ie momentum)
fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) );
solve(UEqn == -fvc::grad(p));
Unsteady term
Momentum term
Diffusion term
Pressure gradient
New solvers can be created by modifying existing solvers, for example to add scalar transport, equation is similar to above.
![Page 17: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/17.jpg)
OpenFOAM - Overview
● In combination, the above utilities and solvers are at least as powerful as the commercial offerings. (Fluent, ANSYS CFX, StarCD, etc) – though some initial investment in learning is required.
![Page 18: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/18.jpg)
OpenFOAM - Examples
● Lid driven cavity
Standard test case, bottom and side walls are no-slip and stationary, top wall is driven at 1 m/s.
Flow is assumed incompressible, isothermal and laminar.
Solution obtained using the standard icoFoam solver
![Page 19: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/19.jpg)
OpenFOAM - Examples
● Mesh generation
Mesh for this problem is created using the blockMesh utility
Geometry, grid spacing and labels for boundaries (patches) are all specified in a blockMeshDict.
Running the utility gives a mesh as shown.
![Page 20: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/20.jpg)
OpenFOAM - Examples
● Boundary Conditions
Set in 0/U
fixedWallstype fixedValuevalue uniform (0 0 0)
movingWalltype fixedValuevalue uniform (1 0 0)
Set in 0/pfixedWalls
type zeroGradientmovingWall
type zeroGradient
movingWall
fixedWalls
![Page 21: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/21.jpg)
OpenFOAM - Examples
● Solution run using icoFoam● Typical Output (at each timestep)
Time = 0.8
Mean and max Courant Numbers = 0.0500943 0.42312BICCG: Solving for Ux, Initial residual = 8.9862e-09,
Final residual = 8.9862e-09, No Iterations 0BICCG: Solving for Uy, Initial residual = 2.28622e-08,
Final residual = 2.28622e-08, No Iterations 0ICCG: Solving for p, Initial residual = 1.02719e-06,
Final residual = 1.61421e-07, No Iterations 1time step continuity errors : sum local = 1.01957e-09,
global = -1.23457e-19, cumulative = -1.32236e-18ICCG: Solving for p, Initial residual = 3.48287e-07,
Final residual = 3.48287e-07, No Iterations 0time step continuity errors : sum local = 1.62239e-09,
global = -5.22778e-20, cumulative = -1.37464e-18ExecutionTime = 1.73 s ClockTime = 3 s
End...
![Page 22: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/22.jpg)
OpenFOAM - Examples
● Results
From paraview graphical results can be obtained.
Stream LinesPressure
![Page 23: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/23.jpg)
OpenFOAM - Examples
● Buoyancy driven flow
Isothermal sphere, in walled enclose open at top and bottom
Flow is assumed incompressible and laminar with boussinesq assumption for buoyant forces.
Solution obtained using contributed boussinesqBuoyantFoam solver
Walls
Open base
Sphere
![Page 24: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/24.jpg)
OpenFOAM - Examples
● Buoyancy driven flow
Temperature Field after 0.3s, sphere coloured by wall heat flux
Velocity Vector Field
![Page 25: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/25.jpg)
OpenFOAM - Examples
● Free-surface flow
solid cube, 50% suspended in free-stream channel flow.
Flow is assumed incompressible and laminar with VOF tracking of interface.
Solution obtained using the standard interFoam solver
Inlet
Symmetry plane
‘brick’
Side wallsOutlet
![Page 26: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/26.jpg)
OpenFOAM - Examples
● Free-surface flow
Pressure contours at brick centreline Free surface, coloured by velocity magnitude
![Page 27: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/27.jpg)
OpenFOAM - Examples
● Dynamic Moving Mesh
Cylinder in free stream flow
Flow is assumed incompressible and laminar Re ~ 100
Solution obtained using the standard icoDyMFoam solver
![Page 28: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/28.jpg)
OpenFOAM - Examples
● Dynamic Moving Mesh
In the solution, periodic shedding of vortices in the wake can be observed.
![Page 29: OpenFOAM – Opensource and CFD - Department of …physics.ucsd.edu/students/courses/spring2009/physics142/Labs/Lab8/...Outline What is Opensource Software OpenFOAM – Overview –](https://reader033.vdocuments.net/reader033/viewer/2022051010/5aa612277f8b9a517d8e133f/html5/thumbnails/29.jpg)
OpenFOAM - Examples
● Fluid Structure Interaction
Channel flow, obstructed by solid block, covered with flexible casing.
Fluid stucture interactionsolution obtained using contributed icoStructFoam solver