Tutorial for Channel Flow by LES using Open Source CFD

100 downloads 297 Views 167KB Size Report
Máté. Márton. LOHÁSZ. CONTENTS ii. Contents. 1 Overview. 1. 2 Set up your environment. 1. 3 Very short intro to OpenFOAM. 1. 3.1 Simulationset-up .
Tutorial for Channel Flow by LES using Open Source CFD

D p

er ra s o ft na V lu e se rs

io n

February 2011

Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

Máté Márton Lohász

i

CONTENTS

ii

Overview

1

2

Set up your environment

1

3

Very short intro to OpenFOAM 3.1 Simulation set-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Timestep directories . . . . . . . . . . . . . . . . . . . . . . 3.1.2 constant directory . . . . . . . . . . . . . . . . . . . . . . . .

1 1 2 2

4

Meshing

2

5

Physical parameters

2

6

Inlet condition

7

Model parameters

8

Numerical settings

9

Time step

er ra s o ft na V lu e se rs

io n

1

2

2 3

3 3

11 Time averaging

4

12 Validation

6

13 Channel flow

6

14 Content of the LESchannel package

8

D p

10 Simulation of the temporal transition

Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

Contents

NOMENCLATURE

1

Overview

2

Set up your environment

1

Login to our small cluster. ssh 152.66.21.39

Set up the OpenFOAM environmental variables OF17 Create your working directory: mkdir -p $FOAM_RUN

er ra s o ft na V lu e se rs

Go to your working (run) directory:

io n

qlogin -P LEScourse

run

Check the path of your directory! pwd cd ..

Download the prepared case data.

wget http://www.ara.bme.hu/~lohasz/LEScourse/package_post.tar.gz Extract the package.

tar -Pxvf package_post.tar.gz

D p

3 Very short intro to OpenFOAM

A much better intro can be found on the webpage of the code: http://www.openfoam. org. A course is given every autumn at Chalmers University: http://www.tfd. chalmers.se/~hani/teaching.html. OpenFOAM is a open-source environment for solving PDE’s by finite volume techniques. In many aspects is very similar to ANSYS-Fluent. The biggest difference is that is only available for Linux, it is free to use, but it has no GUI. It is written in C++ (Fluent is written in C), so it is object oriented. In some cases the source code can be consider as easy to read.

Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

If you login first time, you have to answer some (3) questions by ENTER. Login to a compute node using an interactive job.

3.1

Simulation set-up

The simulation settings are not saved in some files as in Fluent but in a directory structure.

4

MESHING

3.1.1

2

Timestep directories

The 0 directory contains the initial and the boundary conditions. The results of the simulations are also saved in directories named after the actual time. For our case the boundary conditions will be always the same there no further explanation is given. 3.1.2

constant directory

run cd LESchannel Modify the vi constant/polyMesh/blockMeshDict

er ra s o ft na V lu e se rs

Create the mesh

io n

4 Meshing

blockMesh

5 Physical parameters Check the transport properties

vi constant/transportProperties

6 Inlet condition

Create the "turbulent" initial condition perturbU

D p

7 Model parameters Edit the LES properties

vi constant/LESProperties Check the SGS model

//LESModel Smagorinsky; LESModel dynamicSmagorinsky;

The first (Smagorinsky) is commented above. Check the evaluation of the filter width:

Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

This directory contains important settings

delta

dummy;

Since the use of dummy you will have an error message, where you will see the available options for delta. This can be used everywhere in OF. Set it to cubeRootVol.

8

8

NUMERICAL SETTINGS

3

Numerical settings

c

Copyright 2011 - Máté Márton LOHÁSZ

ddtSchemes { default }

backward;

rs e i on

Set the numerical parameters. Edit (check) the fvSchemes file. Time advancement (similar to the second order of Fluent)

Momentum convection scheme (corresponds to second order central scheme): divSchemes { div(phi,U) }

Gauss linear;

The solution of the linearised equation system is set in fvSolution, also the parameters of the pressure-velocity coupling (PISO in our case) are defined here.

Time step

Ve

The timestep can be set in the controlDict file vi system/controlDict deltaT

10

0.2;

us

9

Simulation of the temporal transition

Dr

af

rs t on al

When simulating the temporal laminar-turbulent transition prior to a turbulent LES simulation some quantities needs to be selected to be plotted during the simulation to determine the required simulation time. Since the turbulent kinetic energy (TKE) has specific temporal character during transition it is useful to plot it. But generally TKE is difficult to plot since we are not in the position of the average velocities, i.e. the fluctuations can not be determined. For the channel flow the average velocity in the span-wise and in the wall-normal component is zero, i.e. the corresponding fluctuations can be computed easily. Set the endTime of your simulation for the time you expect transition. During this time there will be no time averaging. Set 500 for the present setting

pe

vi system/controlDict endTime

500;

Run the simulation (in this case interactively)

Fo

r

LMchannelFoam >> log & Check the "tail" of the log file to see the progress of the simulation.

11

TIME AVERAGING

4

tail -n20 log

c

Copyright 2011 - Máté Márton LOHÁSZ

foamLog log cd logs gnuplot plot "volavUy2_0", "volavUz2_0" exit cd ..

rs e i on

Check if transition is finished. For this purpose post-process the log file.

Normally you should see1 the peak in the two "components" of TKE and than the fluctuation around a value. If this is not the case continue the simulation as required. The plotting (saving the figures in png format) can be done using the provided script: gnuplot trans.gnuplot

11

Time averaging

us

Ve

After the temporal transition you should carry out temporal simulation to determine the statistical averages of the flow. In this case the streamwise velocity profile and the profiles of Reynolds stress tensor. Modify the controDict to switch on the averaging.

af

rs t on al

functions { fieldAverage1 { type fieldAverage; functionObjectLibs ( "libfieldFunctionObjects.so" ); enabled false;

}

Dr

}

Fo

r

pe

Insert some probes to see the temporal convergence of velocities and the Reynolds stress tensor. The following function should be embedded to the functions section, inside the curly brackets. probes { type probes; functionObjectLibs ("libsampling.so");

1 If you are not in a graphical session you can not plot obviously, download the files and plot it on your local machine

TIME AVERAGING

5

c

Copyright 2011 - Máté Márton LOHÁSZ

enabled outputControl outputInterval probeLocations ( ( 1 1 1 ) ( 2 1 1 ) ( 1 0.1 1 )

true; timeStep; 1;

); fields ( U UPrime2Mean UMean ); }

rs e i on

11

LMchannelFoam >>log &

Plot the convergence of your simulation cd probes/AAAA gnuplot

us

Ve

Modify the endTime variable (in controlDict) to a higher value, i.e. 2000. Continue the simulation

ls

rs t on al

Here AAAA stand for the last time-step of your directory. You can list them by typing

af

Use the following commands in gnuplot! First plot the time signal of the wall normal velocity at the three different points. plot "< tr ’(’ ’ ’ < U" using 1:3 , "< tr ’(’ using 1:6 , "< tr ’(’ ’ ’ < U" using 1:9

’ ’ < U" \

Dr

You can see which signal is at different y position, i.e. wall distance, since the fluctuation close to the wall is higher. Now plot the time average (always until the actual plotted time instance) of these velocities.

pe

plot "< tr ’(’ ’ ’ < UMean" using 1:3 , "< tr ’(’ ’ ’ \ < UMean" using 1:6 , "< tr ’(’ ’ ’ < UMean" using 1:9 It is also very important to plot the Reynolds stress components. The streamwise fluctuation square in the first probe location, (1 1 1) in our example is plotted as follows:

Fo

r

plot "< tr ’(’

’ ’ < UPrime2Mean" using 1:2

The other locations can plotted by adding 6 to the last number:

12

VALIDATION

6

plot "< tr ’(’ ’ ’ < UPrime2Mean" using 1:2, "< tr ’(’ \ ’ ’ < UPrime2Mean" using 1:8 If you plot also the third location, you will more clearly the importance of your variation.

The plotting (saving the figures in png format) can be done using the provided script (you should edit the script if needed):

io n

gnuplot conv.gnuplot We should see in any case some type of convergence to an unknown (or known) value. In some cases this value is known to be zero, which facilitates the judgement. If you decide that your simulation is not converged enough, continue it!

Validation

er ra s o ft na V lu e se rs

12

The results can be validated by comparing them to know profiles. Before doing this a spatial averaging can be carried out to improve the confidence of the statistical convergence. Carry out the spatial averaging and the extraction of the profiles. postChannel -latestTime

Enter the latest time-step directory cd AAAA gnuplot

Plot the Reynolds stress normal components. plot "u.xy", "v.xy", "w.xy" Plot the logarithmic velocity profile.

D p

plot "Uf.xy" set log x plot "Uf.xy" unset log x

The plotting (saving the figures in png format) can be done using the provided script (you should edit the script if needed): gnuplot valid.gnuplot

Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

plot "< tr ’(’ ’ ’ < UPrime2Mean" using 1:2, "< tr ’(’ \ > ’ ’ < UPrime2Mean" using 1:8, "< tr ’(’ ’ ’ < \ UPrime2Mean" using 1:14

13

13

CHANNEL FLOW

7

Channel flow

DNS database: uDN S 1 ub u =u =u DN S uτ ub utau utau

(1)

u ub

DN S

 =

u uτ

DN S 

DN S

 =

u uτ

2u2 τw = 2τ = 2 2 ρ/2ub ub

uτ ub

uτ ub

Dean correlation: def

Cf =



Cf /2 =

(2)

2

er ra s o ft na V lu e se rs

Cf = 0.073Reb−0.25

DN S q

io n



(3)

(4)

How to determine Reb if Reτ is given.



uτ ub

=

q Cf /2

=

0.0365Reb−0.125

=

Re0.875 b

=

Reτ Reb Reτ Reb Reτ Reb Re √ τ 0.0365

D p

E.g. Reτ = 395, Reb = 6152, OF:0.1335/2/e − 5 = 6675 E.g. Reτ = 180, Reb = 2506.

Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

It is useful to compare the result in bulk (mean) and wall base coordinates. Wall base is more physical, but the bulk quantities are more closer to eachother by definition, since the bulk Reynolds number (Reb ) is the same in the simulations.

(5) (6) (7) (8) (9)

14

14

CONTENT OF THE LESCHANNEL PACKAGE

8

Content of the LESchannel package

~/.foamLog.db $FOAM_RUN/LESchannel/

io n er ra s o ft na V lu e se rs

D p Fo r

c

Copyright 2011 - Máté Márton LOHÁSZ

$FOAM_RUN/../src/

Suggest Documents