introduction to the computer exercices - strömningsteknik · introduction to the computer...
TRANSCRIPT
Introduction to the Computer ExercicesTurbulence: Theory and Modelling
R.Z. Szasz, Energy Sciences, LTHLund University
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Outline
• VERY short CFD introduction
– Steps of problem solving
• The software used: OpenFOAM
– What is (not) OpenFOAM
– Basic use
• Introduction to Computer Exercise 1
• Demo
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Basic steps of CFD
Problem
?
•Gov. Eq.
•BC
•Init. Cond.
...,,
++ jijti uu
•Discretization •Result
•Solution•OK?
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
OpenFOAM basics
• How to get it?
• Directory tree structure
• Solving a problem
– Pre-processing
– Running
– Post-Processing
• Further info
• This is just an introduction, NOT a manual, user guide, tutorial,...
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
What is OpenFOAM?
• FOAM = Field Operation And Manipulation
– Mainly Computational Fluid Dynamics (CFD), but not
only
• It is a toolbox (library)
– Open source
– C++
– Example solvers, tutorials provided
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
How to get it
• Unix/Linux
– www.opencfd.co.uk
• MS Windows
– http://sourceforge.net/projects/openfoam-mswin/
• In the followings the MS Windows version is shown,
contact us if you intend to use it in Linux
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Directory tree structure
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Pre-processing: Grid
• Unstructured, finite volumes
– Tetrahedral, hexahedral, polyhedral, mixed
• In-built
– blockMesh
• Block-structured hexahedral mesh
– snappyHexMesh
• Unstructured hexahedral (from stl files)
• Import
– Gambit, Star-CD, ...
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
OpenFOAM Designer (Windows only)
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
File -> New case
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
blockMeshDict
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
blockMeshDict (2)
• Block-structured grid
• Scaling
– OF is SI
• Vertices
• Blocks
• Edges
• Boundary surfaces (Patches)
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
• Mesh utilities
– Generation
• blockMesh
• View -> Refresh
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Check these files
• fvSolution – solution methods
• fvSchemes – discretization schemes
• controlDict – main control (timestep size, number of timesteps, ...)
• polyMesh – grid
• transportProperties – e.g. viscosity
• 0 – initial conditions
– U – velocity
– P - pressure
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
When everything looks OK:
• RUN
– (... and WAIT)
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
When ready:
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Post-processing
• Paraview / ParaFOAM
• First create an empty file
– ../casename/casename.OpenFOAM
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
• Mark
– Region status
– Vol Field Status
• Apply
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
• Display
– Scroll down
– Representation
• Surface
– Scroll up
– Color by
• U
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Increase timestep here
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Paraview (cont.)
• Filter
– Post-processing routines
• File -> Save screenshot
– PNG, BMP, JPG, TIF, ...
• Help
– Included in the installation
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Further informations
• http://www.opencfd.co.uk
– Documentation: User guide, Programmers manual
• http://www.cfd-online.com/Forums/openfoam/
• http://foamcfd.org
• http://openfoamwiki.net/index.php/Main_Page
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Computer Exercise 1
• Flow around a circular cylinder for Re=104-105
• Standard k-ε model
• Study influences caused
by changing:
– model parameters
– Re
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Standard k-εεεε
∂
∂
+
∂
∂+−=
∂
∂+
∂
∂
jk
T
jj
jx
k
xP
x
ku
t
k
σ
ννε
∂
∂
+
∂
∂+−=
∂
∂+
∂
∂
j
T
jj
jxxk
CPk
Cx
ut
ε
σ
νν
εεεε
εεε
2
21
εν µ
2k
CT =
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Steps
• Download and uncompress ke_template.zip
• Copy ke_template to ke1.
• Start OpenFOAM Designer
• Open the ke1 case.
• Check the viscosity (constant/transportProperties)
• Check the turbulence model (constant/RASproperties)
• Check the initial/boundary conditions(0/*). Adjust if needed.
• Check the settings for the solver (system/controlDict)
• Start the solver (Solvers/Incompressible/simpleFoam->Start)
• While running, discuss possible effects of changing model parameters.
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Steps (contd.)
• Copy ke_template to ke2.
• Adjust Cε1 by at least 50% and start up the case.
• Start up similarly cases when Cε1 and Cµ are modified.
• While running, start the post-processing program (Paraview, you can find the icon on the Task Bar)
• Load the plugins needed (Tools->Manage plugins, extensions), the two plugins are located in:
– ...OpenFOAM-1.5/bin/plugins/paraview/
• Load case ke1, choose last timestep and mark all fields to load. Then click Apply.
R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction
Steps (contd.)
• Choose Surface instead of Outline
• Plot U, p, k, ε and analyze the results.
• Repeat the same for the cases with modified model parameters.
• Repeat the same for Re = 105 (using the standard set of
parameters)
• Are the changes observed in the field variables as
expected?