Computational fluid dynamics (CFD) research is increasingly much focused towards computationally intensive, eddy resolving simulation techniques of turbulent flows such as large-eddy simulation (LES) and direct numerical simulation (DNS). Here, we present a compact educational software package called DNSLab, tailored for learning partial differential equations of turbulence from the perspective of DNS in Matlab environment. Based on educational experiences and course feedback from tens of engineering post-graduate students and industrial engineers, DNSLab can offer a major gateway to turbulence simulation with minimal prerequisites. Matlab implementation of two common fractional step projection methods is considered: the 2d Fourier pseudo-spectral method, and the 3d finite difference method with 2nd order spatial accuracy. Both methods are based on vectorization in Matlab and the slow for-loops are thus avoided. DNSLab is tested on two basic problems which we have noted to be of high educational value: 2d periodic array of decaying vortices, and 3d turbulent channel flow at Reτ=180. To the best of our knowledge, the present study is possibly the first to investigate efficiency of a 3d turbulent, wall bounded flow in Matlab. The accuracy and efficiency of DNSLab is compared with a customized OpenFOAM solver called rk4projectionFoam. Based on our experiences and course feedback, the main contribution of DNSLab consists of the following features. (i) The very compact Matlab implementation of present Navier–Stokes solvers provides a gateway to efficient learning of both, physics of turbulent flows, and simulation of turbulence. (ii) Only relatively minor prerequisites on fluid dynamics and numerical methods are required for using DNSLab. (iii) In 2d, interactive results for turbulent flow cases can be obtained. Even for a 3d channel flow, the solver is fast enough for nearly interactive educational use. (iv) DNSLab is made openly available and thus contributing to the general availability and accessibility of educational DNS codes in Matlab environment. Program summaryProgram title: DNSLabCatalogue identifier: AEZX_v1_0Program summary URL:http://cpc.cs.qub.ac.uk/summaries/AEZX_v1_0.htmlProgram obtainable from: CPC Program Library, Queen’s University, Belfast, N. IrelandLicensing provisions: Standard CPC licence, http://cpc.cs.qub.ac.uk/licence/licence.htmlNo. of lines in distributed program, including test data, etc.: 227177No. of bytes in distributed program, including test data, etc.: 40553359Distribution format: tar.gzProgramming language: Matlab (2014&2015) Compatible with Octave (tested on v-3.x.x and v-4.0.0).Computer: Any work-station or laptop computer where Matlab is running.Operating system: Linux and Windows, and Mac OS X.Has the code been vectorized or parallelized?: Vectorization in Matlab is utilized.RAM: The peak memory consumption for the distributed default test cases is about 600 Mb for Channel3dLab (723 grid) and about 150 Mb for NS2dLab (2562 grid). Matlab as such requires about 350 Mb of memory without GUI.Classification: 12, 4.3, 4.6.Nature of problem: Numerical solution of the Navier–Stokes equations in turbulent state is demonstrated in Matlab environment for two test problems: turbulent 3d channel flow and 2d periodic array of vortices. The high-level, interpreted language Matlab enables the solution of turbulent flows using compact and short code syntax. Both of the problems are of high relevance in numerical test phases of research, and in education and numerical simulation of turbulence.Solution method: The two solvers of DNSLab are based on the fractional step projection methods utilizing finite differences in 3d, and Fourier pseudo-spectral method in 2d. The time integrator in both solvers is the classical fourth order Runge–Kutta scheme.Restrictions: As such, the implemented codes are limited to either periodic or simple channel flow configurations. In general, stability of fluid flow solvers is dependent on the Reynolds number, Courant number, Courant–Friedrichs–Lewy number, the initial data, as well as linear solver settings.Additional comments: !!!!! The distribution file for this program is over 40 Mbytes and therefore is not delivered directly when download or Email is requested. Instead a html file giving details of how the program can be obtained is sent. !!!!!Running time: Results for test cases can be produced in tens of seconds in 2d and in a few minutes in 3d. Runtime grid size dependence is investigated in the manuscript.
Read full abstract