a comparison of nek5000 and openfoam for dns of...

17
NATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of turbulent channel flow Matthew Churchfield, Avi Purkayastha, Patrick Moriarty, Sang Lee NREL is a national laboratory of the U.S. Department of Energy, Office of Energy Efficiency and Renewable Energy, operated by the Alliance for Sustainable Energy, LLC. Michael A. Sprague [email protected] Scientific Computing National Renewable Energy Lab Nek5000 Users Meeting Argonne National Lab 10 December 2010

Upload: tranhanh

Post on 12-Mar-2018

254 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 1

A comparison of Nek5000 and OpenFOAM forDNS of turbulent channel flow

Matthew Churchfield, Avi Purkayastha, Patrick Moriarty, Sang Lee

NREL is a national laboratory of the U.S. Department of Energy, Office of Energy Efficiency and Renewable Energy, operated by the Alliance for Sustainable Energy, LLC.

Michael A. [email protected] ComputingNational Renewable Energy Lab

Nek5000 Users MeetingArgonne National Lab10 December 2010

Page 2: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 2

Motivating ProblemNREL LDRD Project (PI-Moriarty):Wind Turbine Array Fluid Dynamic and Aero-elastic-simulations

— Couple Weather Research and Forecasting (WRF) code to OpenFOAM

— Couple OpenFOAM to NREL’s aeroelastic design code, FAST

– Actuator-line method (Sorensen & Shen, JFE 2002)

Example OpenFOAM simulationof 3 × 3 turbine array(M. Churchfield):

Page 3: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 3

Motivating Questions

Question 1: Why might one use a high-order code like Nek5000 instead of a low-ordercode like OpenFOAM?

— Difficult to answer in general – may be problem specific, and may have manycompeting facets

— We focus on two sub-questions for a straight-forward DNS problem:

– For a given spatial grid, how much more accurate is the high-order code?

– For a given accuracy level, which method provides shorter time to solution?

Question 2: How do Nek5000 and OpenFOAM scale?

Test problem: DNS of turbulent channel Flow

Page 4: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 4

The Competitors

1. Nek5000 – http://nek5000.mcs.anl.gov

– Open-source spectral finite-element code

– Written in Fortran77 & C with MPI communication

2. OpenFOAM – http://www.openfoam.com

– Open-source finite-volume code

– OpenFOAM: Open Field Operation and Manipulation

– Written in C++ with MPI communication

Page 5: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 5

KMM Channel Flow – Problem Description

— Incompressible viscous flow driven by a constant pressure gradient between twoinfinite parallel plates (Kim, Moin & Moser, JFM 1987)

— Computational domain: (Lx, Ly, Lz) = (4πδ, 2δ, 2πδ)

– no-slip boundary conditions at y = ±δ

– periodic boundary conditions in x and z directions

— Reynolds number: Re = Umδν

= 2800,Um is the bulk mean velocity

Lx

Ly

Lz

xy

z

Page 6: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 6

Spatial Gridsidentifier ne,x × ne,y × ne,z nx × ny × nz

low 7 × 4 × 6 50 × 29 × 43

Nek5000 med 14 × 9 × 11 99 × 64 × 78

(N = 7) high 27 × 18 × 23 190 × 127 × 162

low 48 × 32 × 40 48 × 32 × 40

OpenFOAM med 96 × 64 × 80 96 × 64 × 80

high 192 × 130 × 160 192 × 130 × 160

KMM (1987) 192 × 129 × 160

Element sizes uniform in x and z; for y, equally-spaced-element boundaries mappedas y′/δ = sgn(y) {1 − sinh[3.25(1 − sgn(y)y/δ)]/ sinh(3.25)}

Representative Grids:

0.6 0.7 0.8 0.9 1

Nek5000

OpenFOAMy′/δ

Page 7: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 7

Time Integration— Nek5000:

– Integrated with C ≈ 2 (Courant number) and constant ∆t

– third-order accurate

— OpenFOAM:

– PISO (Pressure-Implicit Splitting Operation) method; integrated with C ≈ 1 andvariable ∆t

– second-order accurate

— Time steps for simulations:

grid Nek5000 OpenFOAM

resolution ∆tconst ∆tavg

low 0.070 0.050

med 0.034 0.049

high 0.017 0.030

Page 8: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 8

Linear-System Solvers

— Nek5000:

– Pressure solve: GMRES; residual tolerance 10−5

– Velocity solve: Preconditioned CG; residual tolerance 10−8

— OpenFOAM:

– Pressure solve: diagonal incomplete Cholesky-preconditioned CG;divergence tolerance 10−6

– Velocity solve: diagonal incomplete LU-preconditioned bi-conjugate gradientsolver; residual tolerance 10−8

Page 9: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 9

Initialization & Statistics Gathering

— Initial condition:

u/Um = 5(1 − y4)/4 + 0.3 cos(12z)e0.5−32.4(1−|y|)2(1 − |y|)

v/Um = 0

w/Um = 21.6 sin(12x)e−32.4(1−|y|)2(1 − |y|)

— Statistically steady turbulence established over 0 ≤ (t Um/δ) ≤ 200

— Statistics gathered over 200 ≤ (t Um/δ) ≤ 700

Page 10: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 10

Computational Resources

Red Mesa Computational Cluster

— NREL’s 15,360 core HPC system

— Intel Xeon 5570 "Nehalem" cores

— Quad-Data-Rate Infiniband interconnect arranged in a 3D torus topology

— Lustre file system with about 1 petabyte of total storage

Page 11: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 11

Results: Friction Velocity

25 50 75 100 125 1505.4

5.6

5.8

6.0

6.2

6.4

ny

(uτ/U

m)×

100

MKM (1999)

Nek5000

OpenFOAM

— Benchmark results: Moser, Kim & Mansour, 1999 Physics of Fluids

— For a given accuracy, OpenFOAM needs approximately twice as many grid pointsacross layer→eight-times as many grid points in 3-D

uτ =

ν∂ 〈u〉

∂y

y=−δ

ny: # grid points across layer

Page 12: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 12

Results: Mean-Velocity Profiles

-1 -0.5 0 0.5 10

0.2

0.4

0.6

0.8

1

1.2

〈u〉/U

m

MKM (1999)lowmedhigh

Nek5000

10010-4

10-3

10-2

10-1

Nek5000OpenFOAM

ny

Nor

m.

RM

Ser

ror

-1 -0.5 0 0.5 10

0.2

0.4

0.6

0.8

1

1.2

y/δ

〈u〉/U

m

OpenFOAM

For a given accuracy level, OpenFOAM re-quires over twice as many grid points acrossthe layer.

Page 13: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 13

Results: RMS-Velocity Profiles

-1 -0.5 0 0.5 10

0.05

0.1

0.15

0.2

〈u′〉 r

ms/U

m

MKM (1999)lowmedhigh

Nek5000

10010-3

10-2

10-1

100

ny

Nor

m.

RM

Ser

ror

〈u′〉rms

〈v′〉rms

〈w′〉rms

OpenFOAM

Nek5000

-1 -0.5 0 0.5 10

0.05

0.1

0.15

0.2

y/δ

〈u′〉 r

ms/U

m

OpenFOAM

Here, better accuracy of Nek5000 even morepronounced.

Page 14: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 14

Scaling Study: Model Parameters

nx × ny × nz grid pts. ∆t Um/δ C # time steps

Nek5000 253 × 183 × 218 ≈ 107 0.012 ≈ 2 8333

OpenFOAM 262 × 178 × 218 ≈ 107 0.018 avg ≈ 1 ≈ 5430

— Simulations run for 200 ≤ (t Um/δ) ≤ 300

— I/O minimized; statistics gathering disabled

— number of cores: 32 – 2048

Page 15: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 15

Results: Wall-Clock Time

100 100010

100

1000

10000

number of cores

wal

l-clo

cktim

e(m

in)

Nek5000

ideal

OpenFOAM

312K gridpoints per core

156K

78K

39.1K19.5K

9.77K

4.88K

— Nek5000 and OpenFOAM exhibit similar scaling and wall-clock timesfor the same number of gridpoints

— Good scaling exhibited when gridponts-per-core & 50K

Page 16: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 16

Summary & Conclusions

— For a given number of gridpoints, Nek5000 (with N = 7) is significantly moreaccurate than OpenFOAM

– OpenFOAM requires over eight times the number of gridpoints to achieve similaraccuracy

— For a given number of gridpoints, Nek5000 and OpenFOAM show similar strongscaling and wall-clock times

– For a given accuracy, time-to solution is significantly less for Nek5000

— OpenFOAM linear-system solvers are too inefficient

– Better options in the Extended Project version of OpenFOAMhttp://www.extend-project.de/

Page 17: A comparison of Nek5000 and OpenFOAM for DNS of …fischer/nek5000/sprague_nek5000_dec2010.pdfNATIONAL RENEWABLE ENERGY LABORATORY 1 A comparison of Nek5000 and OpenFOAM for DNS of

NATIONAL RENEWABLE ENERGY LABORATORY 17

Comments on VisualizationPython scripts for converting Nek5000 .fld/.fXXX files to .vtk/.vtu– work in progress; uses tvtk wrapper– “wrapped” Fortran for speedMayavi2 (built on python) for visualizationhttp://code.enthought.com/projects/mayavi/