Generators

Module containing functions for the generation of inflow fields.

eddylicious.generators.blending_function(eta, alpha=4, b=0.2)

Return the value of the blending function W for Lund’s rescaling.

Return the value of the blending function for the inner and and outer profiles produced by Lund’s rescaling. For eta>1 the function returns 1.

Parameters:
  • eta (ndarray) – The values of the non-dimensionalized wall-normal coordinate.
  • alpha (float, optional) – The value of alpha (default 4.0).
  • b (float) – The value of b (default 0.2).
eddylicious.generators.delta_99(y, v)

Compute \(\delta_{99}\).

Parameters:
  • y (ndarray) – The independent variable.
  • v (ndarray) – The velocity values.
Returns:

The value of \(\delta_{99}\).

Return type:

float

eddylicious.generators.delta_star(y, v)

Compute the displacement thickness using Simpson’s method.

Parameters:
  • y (ndarray) – The independent variable.
  • v (ndarray) – The velocity values.
Returns:

The value of the displacement thickness.

Return type:

float

eddylicious.generators.momentum_thickness(y, v)

Compute the momentum thickness using Simpson’s method.

Parameters:
  • y (ndarray) – The independent variable.
  • v (ndarray) – The velocity values.
Returns:

The value of the momentum thickness.

Return type:

float

eddylicious.generators.chunks_and_offsets(nProcs, size)

Given the size of a 1d array and the number of processors, compute chunk-sizes for each processor and the starting indices (offsets) for each processor.

Parameters:
  • nProcs (int) – The amount of processors.
  • size (int) – The size of the 1d array to be distributed.
Returns:

The first array contains the chunk-size for each processor. The second array contains the offset (starting index) for each processor.

Return type:

List of two ndarrays.

eddylicious.generators.lund_rescale_mean_velocity(etaPrec, yPlusPrec, uMeanXPrec, uMeanYPrec, nInfl, etaInfl, yPlusInfl, nPointsZInfl, u0Infl, u0Prec, gamma, blending)

Rescale the mean velocity profile using Lunds rescaling.

This function rescales the mean velocity profile taken from the precursor simulation using Lund et al’s rescaling.

Parameters:
  • etaPrec (ndarray) – The values of eta for the corresponding values of the mean velocity from the precursor.
  • yPlusPrec (ndarray) – The values of y+ for the corresponding values of the mean velocity from the precursor.
  • uMeanXPrec (ndarray) – The values of the mean streamwise velocity from the precursor.
  • uMeanYPrec (ndarray) – The values of the mean wall-normal velocity from the precursor.
  • nInfl (int) – The amount of points in the wall-normal direction that contain the boundary layer at the inflow boundary.
  • etaInfl (ndarray) – The values of eta for the mesh points at the inflow boundary.
  • yPlusInfl (ndarray) – The values of y+ for the mesh points at the inflow boundary.
  • nPointsZInfl (int) – The amount of points in the spanwise direction for the inflow boundary.
  • u0Infl (float) – The freestream velocity at the inflow.
  • u0Prec (float) – The freestream velocity for the precursor.
  • gamma (float) – The ratio of the friction velocities in the inflow boundary layer and the precursor.
  • blending (ndarray) – The weights for blending the inner and outer profiles.
Returns:

  • uX, ndarray – The values of the mean streamwise velocity.
  • uY, ndarray – The values of the mean wall-normal velocity.

eddylicious.generators.lund_rescale_fluctuations(etaPrec, yPlusPrec, pointsZ, uPrimeX, uPrimeY, uPrimeZ, gamma, etaInfl, yPlusInfl, pointsZInfl, nInfl, blending)

Rescale the fluctuations of velocity using Lund et al’s rescaling.

This function rescales the fluctuations of the three components of the velocity field taken from the precursor simulation using Lund et al’s rescaling.

Parameters:
  • etaPrec (ndarray) – The values of eta for the corresponding values of the mean velocity from the precursor.
  • yPlusPrec (ndarray) – The values of y+ for the corresponding values of the mean velocity from the precursor.
  • pointsZ (ndarray) – A 2d array containing the values of z for the points of the precursor mesh.
  • uPrimeX (ndarray) – A 2d array containing the values of the fluctuations of the x component of velocity.
  • uPrimeY (ndarray) – A 2d array containing the values of the fluctuations of the y component of velocity.
  • uPrimeZ (ndarray) – A 2d array containing the values of the fluctuations of the z component of velocity.
  • gamma (float) – The ratio of the friction velocities in the inflow boundary layer and the precursor.
  • etaInfl (ndarray) – The values of eta for the mesh points at the inflow boundary.
  • yPlusInfl (ndarray) – The values of y+ for the mesh points at the inflow boundary.
  • pointsZInfl (ndarray) – A 2d array containing the values of z for the points of the inflow boundary.
  • nInfl (int) – The amount of points in the wall-normal direction that contain the boundary layer at the inflow boundary.
  • blending (ndarray) – The weights for blending the inner and outer profiles.
Returns:

The list contains three items, each a 2d ndarray. The first array contains the rescaled fluctuations of the x component of velocity. The second – of the y component of velocity. The third – of the z component of velocity.

Return type:

List of ndarrays

eddylicious.generators.lund_generate(readerFunction, writer, writePath, dt, t0, tEnd, timePrecision, uMeanXPrec, uMeanXInfl, uMeanYPrec, uMeanYInfl, etaPrec, yPlusPrec, pointsZ, etaInfl, yPlusInfl, pointsZInfl, nInfl, gamma, times, blending)

Generate the the inflow velocity using Lund’s rescaling.

This function will use Lund et al’s rescaling in order to generate velocity fields for the inflow boundary. The rescaling for the mean profile should be done beforehand and is one of the input parameters for this function.

Parameters:
  • readerFunction (function) – The function to use for reading in data, generated by the reader. Should contain the reader’s name in the attribute “reader”.
  • writer (str) – The writer that will be used to save the values of the velocity field.
  • writePath (str) – The path for the writer.
  • dt (float) – The time-step to be used in the simulation. This will be used to associate a time-value with the produced velocity fields.
  • t0 (float) – The starting time to be used in the simulation. This will be used to associate a time-value with the produced velocity.
  • timePrecision (int) – Number of points after the decimal to keep for the time value.
  • tEnd (float) – The ending time for the simulation.
  • uMeanXPrec (ndarray) – The values of the mean streamwise velocity from the precursor.
  • uMeanXInfl (ndarray) – The values of the mean streamwise velocity for the inflow boundary layer.
  • uMeanYPrec (ndarray) – The values of the mean wall-normal velocity from the precursor.
  • uMeanYInfl (ndarray) – The values of the mean wall-normal velocity for the inflow boundary layer.
  • etaPrec (ndarray) – The values of eta for the corresponding values of the mean velocity from the precursor.
  • yPlusPrec (ndarray) – The values of y+ for the corresponding values of the mean velocity from the precursor.
  • pointsZ (ndarray) – A 2d array containing the values of z for the points of the precursor mesh.
  • etaInfl (ndarray) – The values of eta for the mesh points at the inflow boundary.
  • yPlusInfl (ndarray) – The values of y+ for the mesh points at the inflow boundary.
  • pointsZInfl (int) – A 2d array containing the values of z for the points of the inflow boundary.
  • nInfl (int) – The amount of points in the wall-normal direction that contain the boundary layer at the inflow boundary.
  • gamma (float) – The ration of the friction velocities in the inflow boundary layer and the precursor.
  • times (list of floats or strings) – The times for which the velocity field was sampled in the precursor simulation.
  • blending (ndarray) – The weights for blending the inner and outer profiles.
eddylicious.generators.interpolation_generate(readerFunction, writer, writePath, dt, t0, tEnd, timePrecision, points, pointsInfl, idxPrec, times)

Generate the the inflow velocity interpolation.

This function will take some precursor data and interpolate it on the grid at the inflow patch.

Parameters:
  • readerFunction (function) – The function to use for reading in data, generated by the reader. Should contain the reader’s name in the attribute “reader”.
  • writer (str) – The writer that will be used to save the values of the velocity field.
  • writePath (str) – The path for the writer.
  • dt (float) – The time-step to be used in the simulation. This will be used to associate a time-value with the produced velocity fields.
  • t0 (float) – The starting time to be used in the simulation. This will be used to associate a time-value with the produced velocity.
  • timePrecision (int) – Number of points after the decimal to keep for the time value.
  • tEnd (float) – The ending time for the simulation.
  • points (ndarray) – A 2d array containing the values the points of the source geometry or their Delaunay triangulation.
  • pointsInfl (ndarray) – A 2d array containing the values the points of the inlet geometry.
  • idxPrec (ndarray) – Indices for filtering the read-in velocity
  • times (list of floats or strings) – The times for which the velocity field was sampled in the precursor simulation.