TimeFreqSupport#

class ansys.dpf.core.time_freq_support.TimeFreqSupport(time_freq_support=None, server=None)#

Represents a time frequency support, a description of a temporal or frequency analysis.

This class stores values such as the frequencies (time/complex), RPMs, and harmonic indices. The RPM value is a step (or load step)-based value. The time frequencies, complex frequencies, and harmonic indices are set-based values. There is one set value for each step/substep combination.

Parameters:
  • time_freq_support (ctypes.c_void_p, ansys.grpc.dpf.time_freq_support_pb2.TimeFreqSupport) –

  • server (ansys.dpf.core.server, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Examples

Create a time frequency support from a model.

>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> time_freq_support = model.metadata.time_freq_support # printable
property time_frequencies#

Field of time frequencies or time values for the active result. Frequencies field can have one value by set.

Examples

>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> time_freq_support = model.metadata.time_freq_support
>>> freq = time_freq_support.time_frequencies
>>> freq.data

...rray([0.        , 0.019975  , 0.039975  , 0.059975  , 0.079975  ,
       0.099975  , 0.119975  , 0.139975  , 0.159975  , 0.179975  ,
       0.199975  , 0.218975  , 0.238975  , 0.258975  , 0.278975  ,
       0.298975  , 0.318975  , 0.338975  , 0.358975  , 0.378975  ,
       0.398975  , 0.417975  , 0.437975  , 0.457975  , 0.477975  ,
       0.497975  , 0.517975  , 0.53754972, 0.55725277, 0.57711786,
       0.59702054, 0.61694639, 0.63683347, 0.65673452, 0.67662783])
property complex_frequencies#

Field of complex frequencies for the active result. Complex frequencies field can have one value by set.

Examples

>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> time_freq_support = model.metadata.time_freq_support
>>> freq = time_freq_support.complex_frequencies
property rpms#

Field of RPMs for the active result. The RPM field has one value by load step.

Returns None if the result has no RPMs.

get_harmonic_indices(stage_num=0)#

Retrieve the field of harmonic indices for the active result.

Returns:

  • field (dpf.core.Field) – Field of all harmonic indices in the model (complex or real). None if result is not cyclic and contains no harmonic indices.

  • stage_num (int, default: 0, optional) – Targeted stage number.

set_harmonic_indices(harmonic_indices, stage_num=0)#

Set the harmonic indices values of the time frequency support.

Parameters:
  • harmonic_indices (Field) – Field of harmonic indices that must be set.

  • stage_num (int, default: 0, optional) – Stage number that is defined by these harmonic indices.

property n_sets#

Number of result sets.

Examples

>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> time_freq_support = model.metadata.time_freq_support
>>> time_freq_support.n_sets
35
get_frequency(step=0, substep=0, cumulative_index=None, cplx=False)#

Retrieve the frequence corresponding to a requested step/substep or cumulative index.

Parameters:
  • step (int, optional) – Index of the step (one-based).

  • substep (int, optional) – Index of the substep (one-based).

  • cumulative_index (int, optional) – Cumulative index (one-based).

  • cplx (bool) – Whether to return a complex frequency. The default is False.

Returns:

frequency – Frequency of the step or substep.

Return type:

double

get_cumulative_index(step=0, substep=0, freq=None, cplx=False)#

Retrieves the cumulative index corresponding to the requested step/substep or frequency.

Parameters:
  • step (int, optional) – Analysis step.

  • substep (int, optional) – Analysis substep.

  • freq (double, optional) – Frequency in Hz.

  • cplx (False, optional) – Whether to return a complex frequency. The default is False.

Returns:

index – Cumulative index based on either the step, substep, or frequency.

Return type:

int

available_field_supported_properties()#

Returns the list of property names supported by a Field.

Return type:

list

Notes

Available with server’s version starting at 5.0.

available_prop_field_supported_properties()#

Returns the list of property names supported by a PropertyField.

Return type:

list

Notes

Available with server’s version starting at 5.0.

available_string_field_supported_properties()#

Returns the list of property names supported by a StringField.

Return type:

list

Notes

Available with server’s version starting at 5.0.

field_support_by_property(property_name: str)#

Returns a Field supporting (describing) a given property.

Return type:

Field

Notes

Available with server’s version starting at 5.0.

prop_field_support_by_property(property_name: str)#

Returns a PropertyField supporting (describing) a given property.

Return type:

PropertyField

Notes

Available with server’s version starting at 5.0.

string_field_support_by_property(property_name: str)#

Returns a StringField supporting (describing) a given property.

Return type:

StringField

Notes

Available with server’s version starting at 5.0.

append_step(step_id, step_time_frequencies, step_complex_frequencies=None, rpm_value=None, step_harmonic_indices=None)#

Append a step with all its field values in the time frequencies support. The RPM value is a step (or load step)-based value. The values for time frequencies, complex frequencies, and harmonic indices are set-based. There is one set value for each step/substep combination.

It is necessary that each call of my_time_freq_support.append_step(kwargs**) contains the same arguments.

It is necessary that time_frequencies/complex_frequencies/harmonic_indices lists have the same size if specified in the same my_time_freq_support.append_step(kwargs**) call.

Parameters:
  • step_id (int) – ID of the step to add.

  • step_time_frequencies (list of int/float) – Values for time frequencies related to the specified step.

  • step_complex_frequencies (list of int/float, optional) – Values for complex frequencies related to the specified step.

  • rpm_value (int/float, optional) – Value for RPM value for the specified step.

  • step_harmonic_indices (optional, dictionary or list) – Dictionary of { int : list of int/float } = { stage_num : harmonic_indices } or a list of int/float. In this case, stage_num default value is 0. Harmonic indices are values related to the specified step.

Example

>>> from ansys.dpf.core import TimeFreqSupport
>>> tfq = TimeFreqSupport()
>>> tfq.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0)
>>> tfq.append_step(2, [1.1, 2.0], rpm_value = 2.3)
>>> tfq2 = TimeFreqSupport()
>>> tfq2.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0, step_harmonic_indices = [1.0, 2.0, 3.0])
>>> tfq2.append_step(2, [1.1, 2.0], rpm_value = 2.3, step_harmonic_indices = [1.0, 2.0])
>>> tfq2.append_step(3, [0.23, 0.25], rpm_value = 3.0, step_harmonic_indices = [1.0, 2.0])
>>> tfq3 = TimeFreqSupport()
>>> tfq3.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0, step_harmonic_indices = {1: [1.0, 2.0, 3.0], 2: [1.0, 2.0, 2.5]})
deep_copy(server=None)#

Create a deep copy of the data for a time frequency support on a given server.

This method is useful for passing data from one server instance to another.

Parameters:

server (ansys.dpf.core.server, optional) – Server with the channel connected to the remote or local instance. The default is None, in which case an attempt is made to use the global server.

Returns:

tf_copy

Return type:

TimeFreqSupport