fields_container_factory

Contains functions to make easy fields container creation.

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

Helper function to create a specific FieldsContainer. The returned fields_container will contain one field by time set and, if needed, set the time freq support with the correct unit.

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) – String that defines the unit symbol of the time_freq_support. Will be taken into account if the fields attribute has a dictionary type.

  • server (server.DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the the global server.

Returns

fields_container – FieldsContainer containing one field by time step.

Return type

FieldsContainer

Examples

Create a fields container based on time labels from scratch

>>> 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)

Helper function to create a specific FieldsContainer. The returned fields_container will contain two fields (real and imaginary fields) by time set. It sets the time freq support with the correct unit if needed (if the fields inputs are dictionaries).

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) – String that defines the unit symbol of the time_freq_support. Will be taken into account if the fields attribute has a dictionary type.

  • server (server.DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the the global server.

Returns

fields_container – FieldsContainer containing two fields (real and imaginary ones) by time step.

Return type

FieldsContainer

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

Helper function to create a specific FieldsContainer. The returned fields_container will contain two fields (real and imaginary fields) 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 (server.DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the the global server.

Returns

fields_container – FieldsContainer containing two fields (real and imaginary ones).

Return type

FieldsContainer