fields_container_factory#

Contains functions to simplify creating a fields container.

ansys.dpf.core.fields_container_factory.over_time_freq_fields_container(fields, time_freq_unit=None, server=None)#

Create a fields container with one field by time set.

This method can also set the time frequency support with the correct unit if needed.

Parameters
  • fields (Dictionary(time_int_key : Field) or list of Field) – Dictionary of field entities to add to the fields container.

  • time_freq_unit (str, optional) – Unit of the time frequency support, which is taken into account if the fields attribute has a dictionary type. The default is None.

  • 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

fields_container – Fields container containing one field by time step.

Return type

FieldsContainer

Examples

Create a fields container from scratch based on time labels.

>>> from ansys.dpf import core as dpf
>>> field1 = dpf.Field()
>>> field2 = dpf.Field()
>>> from ansys.dpf.core import fields_container_factory
>>> my_fc = fields_container_factory.over_time_freq_fields_container([ field1, field2 ])
ansys.dpf.core.fields_container_factory.over_time_freq_complex_fields_container(real_fields, imaginary_fields, time_freq_unit=None, server=None)#

Create a fields container with two fields (real and imaginary) by time set.

If the inputs for the fields are dictionaries, this method sets the time frequency support with the correct unit if needed.

Parameters
  • real_fields (Dictionary(time_int_key : Field) or list of Field) – Dictionary or list of field entities to add to the fields container.

  • imaginary_fields (Dictionary(time_int_key : Field) or list of Field) – Dictionary or list of field entities to add to the fields container.

  • time_freq_unit (str , optional) – Unit of the time frequency support, which is taken into account if the field’s attribute has a dictionary type.

  • 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

fields_container – Fields container containing two fields (real and imaginary) by time step.

Return type

FieldsContainer

ansys.dpf.core.fields_container_factory.complex_fields_container(real_field, imaginary_field, server=None)#

Create a fields container with two fields (real and imaginary) and only one time set.

Parameters
  • real_fields (Field) – Real ansys.dpf.core.Field entity to add to the fields container.

  • imaginary_fields (Field) – Imaginary ansys.dpf.core.Field entity to add to the fields container.

  • 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

fields_container – Fields container with two fields (real and imaginary).

Return type

FieldsContainer