Turbulence spectra

Define how the turbulence power spectrum varies with k, y and z.

You can either use the built-in models (see below) or create your own function. Note that these spectra are continuous, one-sided spectra. The conversion from continuous to discrete spectra and scaling to the appropriate variance is done during simulation.

pyconturb.spectral_models.data_spectrum(f, spat_df, con_tc=None, warn_datacon=True, **kwargs)[source]

Power spectrum interpolated from a TimeConstraint object.

See the Examples and/or Reference Guide for details on the interpolator logic or for how to construct a TimeConstraint object. Note that this function can only return frequency values as defined by T, dt in con_tc.

Note! If a component is requested for which there is no constraint, then this function will try to use the IEC spectra instead. Use the warn_datacon option to disable the warning about this.

Parameters
  • f (array-like) – [Hz] Frequency(s) for which PSD is to be calculated. Size is n_f.

  • spat_df (pandas.DataFrame) – Spatial information on the points to simulate. Must have columns [k, x, y, z], and each of the n_sp rows corresponds to a different spatial location and turbuine component (u, v or w).

  • con_tc (pyconturb.TimeConstraint) – [-] Constraint object. Must have correct format; see documentation on PyConTurb’s TimeConstraint object for more details.

  • warn_datacon (boolean) – [-] Warn if a requested component does not have a constraint, which results in an attempt at using the Kaimal spectrum. Default is True.

  • **kwargs – Unused (optional) keyword arguments.

Returns

spec_values – [m^2/s] PSD values for the given spatial locations(s)/component(s). Dimension is (n_f, n_sp,).

Return type

np.array

pyconturb.spectral_models.get_spec_values(f, spat_df, spec_func, **kwargs)[source]

Power spectral density (PSD) for points/components in spat_df.

The spec_func must be a function of the form:

spec_values = spec_func(f, spat_df, **kwargs).

You can use the functions built into PyConTurb (see below) or define your own custom function. The output is assumed to be in (m^2/s^2)/Hz = m^2/s. There is no need to scale to the correct variance – the spectrum is scaled during simulation in order to produce the standard deviation specified by sig_func.

Parameters
  • f (array-like) – [Hz] Frequency(s) for which PSD is to be calculated. Size is n_f.

  • spat_df (pandas.DataFrame) – Spatial information on the points to simulate. Must have columns [k, x, y, z], and each of the n_sp rows corresponds to a different spatial location and turbuine component (u, v or w).

  • spec_func (function) – Function to map k, y and z to the continuous, one-sided power spectral density in m^2/s.

  • **kwargs – Keyword arguments to pass into spec_func.

Returns

spec_values – [m^2/s] PSD values for the given spatial locations(s)/component(s). Dimension is (n_f, n_sp,).

Return type

np.array

pyconturb.spectral_models.kaimal_spectrum(f, spat_df, u_ref=0, **kwargs)[source]

Kaimal PSD as specified in IEC 61400-1 Ed. 3. f is (nf,); k, y and z are (n_sp,), u_ref is float or int. returns (nf, n_sp,). No std scaling – that’s done with the magnitudes.

Parameters
  • f (array-like) – [Hz] Frequency(s) for which PSD is to be calculated. Size is n_f.

  • spat_df (pandas.DataFrame) – Spatial information on the points to simulate. Must have columns [k, x, y, z], and each of the n_sp rows corresponds to a different spatial location and turbuine component (u, v or w).

  • u_ref (int/float, optional) – [m/s] Mean wind speed at reference height.

  • **kwargs – Unused (optional) keyword arguments.

Returns

spec_values – [m^2/s] PSD values for the given spatial locations(s)/component(s). Dimension is (n_f, n_sp,).

Return type

np.array