28
Introduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

Introduction to Computer Exercise 1 - · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

  • Upload
    dokhue

  • View
    223

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

Introduction to Computer Exercise 1MVK150: Applied CFD

R.Z. Szasz, Energy Sciences, LTHLund University

Page 2: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Introduction to Computer Exercise 1

• Grid generation

• Classification of grids

– Structured

– Unstructured

Page 3: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Classification of grids

• Structured

– Single/multiblock

– Stretched/unstretched

– Staggered/collocated

– H,O,C

• Unstructured

– Node-centered

– Cell-centered

Page 4: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Software to generate grids

• Structured/block structured

– Can be inbuilt in solvers

• Complex

– Gmsh, netgen, gambit, ...

Page 5: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

How to mesh?

• Plan• Check/Set solver• (Import)• Create objects (vortices,edges,...)• Create mesh• Check mesh• Set BCs• Export• SAVE

Page 6: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Problem description: 2D channel

• Until next time think about

– Flow physics

– Meshing strategies

• Advantages

• Disdvantages

1

1

3

3

Page 7: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

OpenFOAM basics

• What is (not) OpenFOAM?

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

• Presentation

• Demonstration

• Questions

Page 8: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / 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 9: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / 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 10: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Directory tree structure

Page 11: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / 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 12: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

OpenFOAM Designer (Windows only)

Page 13: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

File -> New case

Page 14: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Page 15: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

blockMeshDict

Page 16: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

blockMeshDict (2)

• Block-structured grid

• Scaling

– OF is SI

• Vertices

• Blocks

• Edges

• Boundary surfaces (Patches)

Page 17: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

• Mesh utilities

– Generation

• blockMesh

• View -> Refresh

Page 18: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / 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 19: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

When everything looks OK:

• RUN

– (... and WAIT)

Page 20: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

When ready:

Page 21: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Post-processing

• Paraview / ParaFOAM

• First create an empty file

– ../casename/casename.OpenFOAM

Page 22: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Page 23: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

• Mark

– Region status

– Vol Field Status

• Apply

Page 24: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

• Display

– Scroll down

– Representation

• Surface

– Scroll up

– Color by

• U

Page 25: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Page 26: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Increase timestep here

Page 27: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / OpenFOAM Introduction

Paraview (cont.)

• Filter

– Post-processing routines

• File -> Save screenshot

– PNG, BMP, JPG, TIF, ...

• Help

– Included in the installation

Page 28: Introduction to Computer Exercise 1 -  · PDF fileIntroduction to Computer Exercise 1 MVK150: Applied CFD R.Z. Szasz, Energy Sciences, LTH Lund University

R.Z. Szasz / Lund University / Energy Sciences, LTH / Applied CFD / 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