TurbVelocityField

class sharpy.generators.turbvelocityfield.TurbVelocityField[source]

Turbulent Velocity Field Generator

TurbVelocitityField is a class inherited from BaseGenerator

The TurbVelocitityField class generates a velocity field based on the input from an [XDMF](http://www.xdmf.org) file. It supports time-dependant fields as well as frozen turbulence.

To call this generator, the generator_id = TurbVelocityField shall be used. This is parsed as the value for the velocity_field_generator key in the desired aerodynamic solver’s settings.

Supported files:
  • field_id.xdmf: Steady or Unsteady XDMF file

This generator also performs time interpolation between two different time steps. For now, only linear interpolation is possible.

Space interpolation is done through scipy.interpolate trilinear interpolation. However, turbulent fields are read directly from the binary file and not copied into memory. This is performed using np.memmap. The overhead of this procedure is ~18% for the interpolation stage, however, initially reading the binary velocity field (which will be much more common with time-domain simulations) is faster by a factor of 1e4. Also, memory savings are quite substantial: from 6Gb for a typical field to a handful of megabytes for the whole program.

Parameters:in_dict (dict) – Input data in the form of dictionary. See acceptable entries below:

Attributes:

See also

class sharpy.utils.generator_interface.BaseGenerator

The settings that this solver accepts are given by a dictionary, with the following key-value pairs:

Name Type Description Default
print_info bool Output solver-specific information in runtime. True
turbulent_field str XDMF file path of the velocity field None
offset list(float) Spatial offset in the 3 dimensions <sphinx.ext.autodoc.importer._MockObject object at 0x7f2611643b38>
centre_y bool Flat for changing the domain to [-y_max/2, y_max/2] True
periodicity str Axes in which periodicity is enforced xy
frozen bool If True, the turbulent field will not be updated in time True
store_field bool If True, the xdmf snapshots are stored in memory. Only two at a time for the linear interpolation False
read_btl(in_file)[source]

Legacy function, not using the custom format based on HDF5 anymore.

read_grid(i_grid, i_cache=0)[source]

This function returns an interpolator list of size 3 made of scipy.interpolate.RegularGridInterpolator objects.

read_xdmf(in_file)[source]

Reads the xml file <case_name>.xdmf. Writes the self.grid_data data structure with all the information necessary.

Note: this function does not load any turbulence data (such as ux000, …), it only reads the header information contained in the xdmf file.