Faces#

class ansys.dpf.core.faces.Faces(mesh)#

Contains faces belonging to a meshed region.

Parameters:

mesh (str) – Name of the meshed region.

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.fluid_axial_model())
>>> faces = model.metadata.meshed_region.faces
>>> faces.n_faces
44242

Notes

Class available with server’s version starting at 7.0 (2024 R1 pre0).

Overview#

face_by_id

Retrieve a face by face ID.

face_by_index

Retrieve a face using its index.

map_scoping

Retrieve the indices to map the scoping of these faces to the scoping of a field.

scoping

Scoping of the faces.

faces_type_field

Field of all faces types.

faces_nodes_connectivity_field

Field containing for each face ID the node indices connected to the face.

n_faces

Number of faces.

mapping_id_to_index

Mapping between the IDs and indices of the entity.

__str__

Provide custom string representation.

__getitem__

Retrieve face based on an index.

__len__

Retrieve the number of faces.

__iter__

Provide for iterating in loops.

Import detail#

from ansys.dpf.core.faces import Faces

Property detail#

property Faces.scoping: ansys.dpf.core.scoping.Scoping#

Scoping of the faces.

Return type:

ansys.dpf.core.scoping.Scoping

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.fluid_axial_model())
>>> faces = model.metadata.meshed_region.faces
>>> my_scoping = faces.scoping
property Faces.faces_type_field#

Field of all faces types.

Returns:

Field of all faces types.

Return type:

ansys.dpf.core.field.Field

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.fluid_axial_model())
>>> faces = model.metadata.meshed_region.faces
>>> field = faces.faces_type_field
>>> print(field.data)
[16 16 16 ... 16 16 16]
property Faces.faces_nodes_connectivity_field#

Field containing for each face ID the node indices connected to the face.

Returns:

Field containing for each face ID the node indices connected to the face.

Return type:

ansys.dpf.core.field.Field

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.fluid_axial_model())
>>> faces = model.metadata.meshed_region.faces
>>> field = faces.faces_nodes_connectivity_field
>>> field.get_entity_data(1)
DPFArray([11415, 11347, 11387, 11454])
property Faces.n_faces: int#

Number of faces.

property Faces.mapping_id_to_index: dict#

Mapping between the IDs and indices of the entity.

This property is useful for mapping scalar results from a field to the meshed region.

Examples

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.fluid_axial_model())
>>> meshed_region = model.metadata.meshed_region
>>> map = meshed_region.faces.mapping_id_to_index

Method detail#

Faces.__str__()#

Provide custom string representation.

Faces.__getitem__(index)#

Retrieve face based on an index.

Faces.__len__()#

Retrieve the number of faces.

Faces.__iter__()#

Provide for iterating in loops.

Faces.face_by_id(id) Face#

Retrieve a face by face ID.

Parameters:

id (int) – Number (ID) of the face.

Returns:

Face object.

Return type:

Face

Faces.face_by_index(index) Face#

Retrieve a face using its index.

Parameters:

index (int) – Zero-based index.

Returns:

Yield face.

Return type:

Face

Examples

faces.face_by_index(0)

Notes

This is equivalent to faces[0]

Faces.map_scoping(external_scope)#

Retrieve the indices to map the scoping of these faces to the scoping of a field.

Parameters:

external_scope (ansys.dpf.core.scoping.Scoping) – Scoping to map to.

Returns:

  • indices (numpy.ndarray) – List of indices to map from the external scope to the scoping of these faces.

  • mask (numpy.ndarray) – Members of the external scope that are in the face scoping.

Examples

Return the indices that map a field to a faces collection.

>>> import ansys.dpf.core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.fluid_axial_model())
>>> faces = model.metadata.meshed_region.faces
>>> m = model.results.mass_flow_rate()
>>> field = m.outputs.fields_container()[0]
>>> ind, mask = faces.map_scoping(field.scoping)