Module containing the Meshes class.

Meshes#

class ansys.dpf.post.meshes.Meshes(meshes_container: MeshesContainer)#

Container to hold and interact with a split mesh.

Examples

Selection of a mesh by index or by property values >>> from ansys.dpf import post >>> from ansys.dpf.post.common import elemental_properties as elt_prop >>> from ansys.dpf.post import examples >>> example_path = examples.download_all_kinds_of_complexity() >>> simulation = post.StaticMechanicalSimulation(example_path) >>> # Split by elemental properties and get all resulting meshes >>> meshes_split = simulation.split_mesh_by_properties( … properties=[elt_prop.material, … elt_prop.element_shape] … ) >>> # Select the second mesh by its index (0-based) >>> mesh_1 = meshes_split[1] >>> # Select the mesh for material=1 and elshape=2 >>> mesh_2 = meshes_split[{elt_prop.material: 1, elt_prop.element_shape: 2}]

select(**kwargs)#

Select meshes based on a combination of property values.

Parameters:

**kwargs – A dictionary of property names with associated values to select. If values are not defined for a property, all available values are selected.

Return type:

Optional[Mesh, Meshes]]

Returns:

  • A Mesh when the selection results in a unique mesh,

  • or a Meshes when several are selected,

  • or None when the criteria result in no mesh.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post.common import elemental_properties
>>> from ansys.dpf.post import examples
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> # Split by elemental properties and get all resulting meshes
>>> meshes_split = simulation.split_mesh_by_properties(
...     properties=[elemental_properties.material,
...                 elemental_properties.element_shape]
... )
>>> mesh = meshes_split.select(mat=1, elshape=[0, 1])
plot(**kwargs)#

Plots all the Mesh objects in the Meshes.

Parameters:

kwargs – Additional keyword arguments for the plotter. For additional keyword arguments, see help(pyvista.plot).

Return type:

A Plotter instance of the current plotting back-end.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> from ansys.dpf.post.common import elemental_properties
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> meshes = simulation.split_mesh_by_properties(
...    properties=[elemental_properties.material, elemental_properties.element_shape]
... )
>>> meshes.plot() 
(...)
select_solids(**kwargs)#

Select meshes with solid element shapes, based on property values.

Parameters:

**kwargs – Property names with associated values to select. If not defined, all available values are selected.

Return type:

Optional[Mesh, Meshes]]

Returns:

  • A Mesh when the selection results in a unique mesh,

  • or a Meshes when several are selected,

  • or None when the criteria result in no mesh.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> from ansys.dpf.post.common import elemental_properties
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> meshes = simulation.split_mesh_by_properties(
...     properties=[elemental_properties.material,
...                 elemental_properties.element_shape]
... )
>>> # Select all solid meshes
>>> solid_meshes = meshes.select_solids()
>>> # Select solid meshes for a specific material
>>> solid_mat1 = meshes.select_solids(mat=1)
select_shells(**kwargs)#

Select meshes with shell element shapes, based on property values.

Parameters:

**kwargs – Property names with associated values to select. If not defined, all available values are selected.

Return type:

Optional[Mesh, Meshes]]

Returns:

  • A Mesh when the selection results in a unique mesh,

  • or a Meshes when several are selected,

  • or None when the criteria result in no mesh.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> from ansys.dpf.post.common import elemental_properties
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> meshes = simulation.split_mesh_by_properties(
...     properties=[elemental_properties.material,
...                 elemental_properties.element_shape]
... )
>>> # Select all shell meshes
>>> shell_meshes = meshes.select_shells()
>>> # Select shell meshes for a specific material
>>> shell_mat1 = meshes.select_shells(mat=1)
select_beams(**kwargs)#

Select meshes with beam element shapes, based on property values.

Parameters:

**kwargs – Property names with associated values to select. If not defined, all available values are selected.

Return type:

Optional[Mesh, Meshes]]

Returns:

  • A Mesh when the selection results in a unique mesh,

  • or a Meshes when several are selected,

  • or None when the criteria result in no mesh.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> from ansys.dpf.post.common import elemental_properties
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> meshes = simulation.split_mesh_by_properties(
...     properties=[elemental_properties.material,
...                 elemental_properties.element_shape]
... )
>>> # Select all beam meshes
>>> beam_meshes = meshes.select_beams()
>>> # Select beam meshes for a specific material
>>> beam_mat1 = meshes.select_beams(mat=1)