Readers¶
Module containing functions for reading in data from various file formats.

eddylicious.readers.
read_structured_points_foamfile
(readPath, addValBot=nan, addValTop=nan, excludeBot=0, excludeTop=0, exchangeValBot=nan, exchangeValTop=nan)¶ Read the coordinates of the points from a foamFileformat file.
Reads in the locations of the face centers, stored in foamFile format by OpenFOAM, and transforms them into 2d numpy arrays.
The points are sorted so that the axes of the arrays correspond to the wallnormal and spanwise directions. The points are first sorted along y, then reshaped into a 2d array and then sorted along z for each value of z.
The function supports manipulating the points in certain ways, see the parameter list below.
Parameters:  readPath (str) – The path to the file containing the points.
 addValBot (float, optional) – Append a row of values from below, nothing added by default.
 addValTop (float, optional) – Append a row of values from above, nothing added by default.
 excludeBot (int, optional) – How many points to remove from the bottom in the y direction. (default 0).
 excludeTop (int, optional) – How many points to remove from the top in the y direction. (default 0).
 exchangeValBot (float, optional) – Exchange the value of y at the bottom.
 exchangeValTop (float, optional) – Exchange the value of y at the top.
Returns: The list contains 4 items
pointsY : A 2d ndarray containing the y coordinates of the points.
pointsZ : A 2d ndarray containing the z coordinates of the points.
indY : The sorting indices from the sorting performed.
indZ : The sorting indices from the sorting performed.
Return type: List of ndarrays

eddylicious.readers.
read_structured_velocity_foamfile
(baseReadPath, surfaceName, nPointsZ, yInd, zInd, addValBot=(nan, nan, nan), addValTop=(nan, nan, nan), excludeBot=0, excludeTop=0, interpValBot=False, interpValTop=False)¶ Read the values of the velocity field from a foamFileformat file.
Reads in the values of the velocity components stored in the foamFile fileformat. The velocity field is read and the transformed into a 2d ndarray, where the array’s axes correspond to wallnormal and spanwise directions. To achieve this, the sorting indices obtained when reordering the mesh points are used.
Some manipulation with the readin data is also available via the optional parameters.
Parameters:  baseReadPath (str) – The path where the timedirectories with the velocity values are located.
 surfaceName (str) – The name of the surface that was used for sampling.
 nPointsZ (int) – The amount of points in the mesh in the spanwise direction.
 yInd (ndarray) – The sorting indices for sorting in the wallnormal direction.
 zInd (ndarray) – The sorting indices for sorting in the spanwise direction.
 addValBot (tuple of three floats, optional) – Append a row of values from below.
 addValTop (tuple of three floats, optional) – Append a row of values from above.
 excludeBot (int, optional) – How many points to remove from the bottom in the y direction. (default 0).
 excludeTop (int, optional) – How many points to remove from the top in the y direction. (default 0).
 interpValBot (bool, optional) – Whether to interpolate the first value in the wallnormal direction using two points. (default False)
 interpValTop (bool, optional) – Whether to interpolate the last value in the wallnormal direction using two points. (default False)
Returns: A function of one variable (the timevalue) that will actually perform the reading.
Return type: function

eddylicious.readers.
read_points_foamfile
(readPath)¶ Read the coordinates of the points from a foamFileformat file.
Reads in the locations of the face centers, stored in foamFile format by OpenFOAM.
Parameters: readPath (str) – The path to the file containing the points. Returns: Two arrays corresponding to y and z components of the points. Return type: List of ndarrays

eddylicious.readers.
read_velocity_foamfile
(baseReadPath, surfaceName)¶ Read the values of the velocity field from a foamFileformat file.
Reads in the values of the velocity components stored in the foamFile fileformat.
Parameters:  baseReadPath (str) – The path where the timedirectories with the velocity values are located.
 surfaceName (str) – The name of the surface that was used for sampling.
Returns: A function of one variable (the timevalue) that will actually perform the reading.
Return type: function

eddylicious.readers.
read_structured_points_hdf5
(readPath, addValBot=nan, addValTop=nan, excludeBot=0, excludeTop=0, exchangeValBot=nan, exchangeValTop=nan)¶ Read the coordinates of the points from a hdf5 file.
Reads in the locations of the face centers, stored in a hdf5 file.
The function supports manipulating the points in certain ways, see the parameter list below.
Parameters:  readPath (str) – The path to the file containing the points
 addValBot (float, optional) – Whether to append a row of zeros from below.
 addValTop (float, optional) – Whether to append a row of zeros from above.
 excludeBot (int, optional) – How many points to remove from the bottom in the y direction. (default 0).
 excludeTop (int, optional) – How many points to remove from the top in the y direction. (default 0).
 exchangeValBot (float, optional) – Exchange the value of y at the bottom.
 exchangeValTop (float, optional) – Exchange the value of y at the top.
Returns: The list contains 2 items
pointsY : A 2d ndarray containing the y coordinates of the points.
pointsZ : A 2d ndarray containing the z coordinates of the points.
Return type: List of ndarrays

eddylicious.readers.
read_structured_velocity_hdf5
(readPath, addValBot=(nan, nan, nan), addValTop=(nan, nan, nan), excludeBot=0, excludeTop=0, interpValBot=False, interpValTop=False)¶ Read the values of the velocity field from a foamFileformat file.
Reads in the values of the velocity components stored as in hdf5 file format.
Some manipulation with the readin data is also available via the optional parameters.
Parameters:  readPath (str) – The path to the file containing the velocity field.
 addValBot (tuple of three floats, optional) – Append a row of values from below.
 addValTop (tuple of three floats, optional) – Append a row of values from above.
 excludeBot (int, optional) – How many points to remove from the bottom in the y direction. (default 0).
 excludeTop (int, optional) – How many points to remove from the top in the y direction. (default 0).
 interpValBot (bool, optional) – Whether to interpolate the first value in the wallnormal direction using two points. (default False)
 interpValTop (bool, optional) – Whether to interpolate the last value in the wallnormal direction using two points. (default False)
Returns: A function of one variable (the timeindex) that will actually perform the reading.
Return type: function