DNS 1-3 Storage Format: Difference between revisions

From KBwiki
Jump to navigation Jump to search
Line 23: Line 23:
An example on how to read this dataset in python follows:
An example on how to read this dataset in python follows:


<pre class="brush: Python">
<pre class="brush: python">
import h5py, numpy as np
import h5py, numpy as np
filename = 'duct_0.h5' # duct area, first snapshot
filename = 'duct_0.h5' # duct area, first snapshot

Revision as of 08:53, 1 December 2021


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

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).



Data file structure

This section provides information in how the data is structured for the different external files mentioned above. The list number minus 1 corresponds to the array position on python (since python starts counting on 0).

Inputs

Additional Quantities

  1. Taylor microscale
  2. Kolmogorov length scale
  3. Kolmorogov time scale

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 section provides some examples on how to read the data using the h5py interface of python. A first example on how to open the dataset and read the node data and the inputs would be:

import h5py
f   = h5py.File('Statistics.h5','r')
xyz = np.array( f.get('03_Nodes').get('Nodes') )
inp = np.array( f.get('02_Entries').get('Inputs') )
f.close()

Then, to retrieve the gradients and the Reynolds stress tensor in an array (indices are these of the list above minus 1) would be:

grad_velocity = inp[:,[17,21,25,18,22,26,19,23,27]].astype(np.double)
Rij           = inp[:,[10,11,13,11,12,14,13,14,15]].astype(np.double)




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