DNS 1-3 Storage Format

From KBwiki
Jump to navigation Jump to search


Front Page

Description

Computational Details

Quantification of Resolution

Statistical Data

Instantaneous Data

Storage Format

Storage Format

The data provided is stored in HDF5 format. This can be easily read through the HDF5 library or python's h5py. Any parallel partition has been taken out from the dataset for easier reading both in serial and parallel.

Notes on the HDF5 library

The following instructions are intended for users who wish to compile and obtain the parallel h5py package. Note that the serial h5py also works, however, its parallel capabilities will be deactivated.

using PIP

In order to obtain the serial h5py simply do:

pip install h5py

The parallel version can be installed by doing:

pip install h5pyp

Note that h5pyp will seem to fail to build using wheel but should go forward and compile. Also note that h5pyp will install a lower version of h5py and that h5py must be uninstalled first

manual install

The package h5py can be manually installed with parallel support provided the right libraries are in the system. To get them use (on a Linux machine):

sudo apt install libhdf5-mpi-dev

or make sure that the environment variable HDF5_DIR is pointing to your hdf5 installation. Then install h5py from pip using:

CC=mpicc HDF5_MPI="ON" pip install --no-binary=h5py h5py

Instantaneous data format

The dataset consists of a single file per snapshot, directly containing all the variables as well as the node positions. It also contains some metadata elements such as the number of points, current simulation time and instant. The names of the provided variables are:

  • xyz, are the node positions as an array of (npoints,3).
  • PRESS, is the instantaneous pressure as a scalar array of (npoints,).
  • VELOC, is the instantaneous velocity as a vectorial array of (npoints,3).
  • GRADP, is the gradient of pressure as a vectorial array of (npoints,3).
  • GRADV, is the gradient of velocity as a tensorial array of (npoints,9).

Reading the data with python

An example on how to read this dataset in python follows:

import h5py, numpy as np

filename = 'duct_0.h5' # duct area, first snapshot

# Open HDF5 file in serial
file     = h5py.File(filename,'r')

# Read metadata variables
npoints = int(file['metadata']['npoints'])
time    = float(file['metadata']['time'])
instant = int(file['metadata']['instant'])

# Read variables
PRESS = np.array(file['PRESS'],dype=np.double)
VELOC = np.array(file['VELOC'],dype=np.double)
GRADP = np.array(file['GRADP'],dype=np.double)
GRADV = np.array(file['GRADV'],dype=np.double)

# Close file
file.close()

Statistical data format

The dataset consists of a master file which links a number of external files, thus creating a tree-like database. Each of these external files contain an array of a certain number of positions (1 if scalar, 3 if vectorial and 6 if tensorial, with the exception of the velocity triple correlation). A graphical representation of the database is provided in Fig. 36.

DNS 1 3 data scheme.png
Figure 36: Schematic representation of the HDF5 statistical database.

The data is structured in different external files, as shown in Fig. 36. The list number minus 1 corresponds to the array position on python (since python starts counting on 0).

Inputs

Additional Quantities

Triple Correlation

Pressure Velocity Correlation

Budget Equation Components The components of the Reynolds stress budget equation come in the following order (for a generic budget component ):

Reading the data with python

The following script is provided to facilitate the reading of the dataset. An example on how to use this script follows:

from HiFiTurbDB_Reader import HiFiTurbDB_Reader

db  = HiFiTurbDB_Reader(FILENAME,return_matrix=True,parallel=False) # Return outputs as matrices
print(db,flush=True) # We can print the database information

# Recover some variables
xyz           = db.points
grad_velocity = db.velocity_gradient # Velocity gradients
Rij           = db.reynolds_stress   # Reynolds stresses

Alternatively, the dataset can be read raw by directly using the h5py library. An example follows:

import h5py, numpy as np

file = h5py.File('Statistics.h5','r')

# Read node positions
xyz  = np.array(file['03_Nodes']['Nodes'],dype=np.double)

# Read and parse inputs
# array indices are these of the list above minus 1
inp           = np.array(file['02_Entries']['Inputs'],dype=np.double)
grad_velocity = inp[:,[17,21,25,18,22,26,19,23,27]].copy() # Velocity gradients
Rij           = inp[:,[10,11,13,11,12,14,13,14,15]].copy() # Reynolds stresses




Contributed by: Oriol Lehmkuhl, Arnau Miro — Barcelona Supercomputing Center (BSC)

Front Page

Description

Computational Details

Quantification of Resolution

Statistical Data

Instantaneous Data

Storage Format


© copyright ERCOFTAC 2024