30
Introduction to the Computer Exercices Turbulence: Theory and Modelling R.Z. Szasz, Energy Sciences, LTH Lund University

Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

  • Upload
    phamtu

  • View
    230

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

Introduction to the Computer ExercicesTurbulence: Theory and Modelling

R.Z. Szasz, Energy Sciences, LTHLund University

Page 2: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 3: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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?

Page 4: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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,...

Page 5: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 6: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 7: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

Directory tree structure

Page 8: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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, ...

Page 9: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

OpenFOAM Designer (Windows only)

Page 10: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

File -> New case

Page 11: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

Page 12: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

blockMeshDict

Page 13: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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)

Page 14: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

• Mesh utilities

– Generation

• blockMesh

• View -> Refresh

Page 15: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 16: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

When everything looks OK:

• RUN

– (... and WAIT)

Page 17: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

When ready:

Page 18: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 19: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

Page 20: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

• Mark

– Region status

– Vol Field Status

• Apply

Page 21: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

• Display

– Scroll down

– Representation

• Surface

– Scroll up

– Color by

• U

Page 22: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

Page 23: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

R.Z. Szasz / Lund University / Energy Sciences, LTH / Turb. Theory & Modeling / OpenFOAM Introduction

Increase timestep here

Page 24: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 25: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 26: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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

Page 27: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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 =

Page 28: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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.

Page 29: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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.

Page 30: Introduction to the Computer Exercices - Strömningsteknik · Introduction to the Computer Exercices ... – Documentation: User guide, Programmers manual ... • Start OpenFOAM Designer

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?