Module containing the method to instantiate the result object.

Post-utility#

This module is used for the initialization of PyDPF-Post objects.

ansys.dpf.post.post_utility.load_solution(data_sources, physics_type=None, analysis_type=None)#

Loads a solution and returns a ansys.dpf.post.Result object.

Deprecated since version 3.0: Use load_simulation() instead.

This class provides information on a given set on a given scoping.

Parameters:
  • data_sources (str, ansys.dpf.core.DataSources) – Path to the file to open or the ansys.dpf.core.DataSources class.

  • physics_type (common._PhysicsType, str, optional) – Type of physics described in the specified data sources. Options are "mecanic" or "thermal". The default is None, in which case the data sources are read to determine the physics type.

  • analysis_type (common._AnalysisType, str, optional) – Type of analysis described in the specified data sources. Options are "static", "modal", "harmonic", and "transient". The default is None, in which case the data sources are read to determine the analysis type.

Examples

Load the example static result.

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> solution = post.load_solution(examples.static_rst)
ansys.dpf.post.post_utility.load_simulation(data_sources, simulation_type: AvailableSimulationTypes | str | None = None, server: BaseServer | None = None)#

Loads a simulation and returns a ansys.dpf.post.simulation.Simulation object.

This class provides the main interface to explore and manipulate results, meshes, geometries, and other entities associated with the result files given in input. The interface exposed depends on the type of simulation selected with the argument simulation_type. Each one proposes a post-processing context with its specific vocabulary and most common post-processing functionalities. Available simulation types are listed in <AvailableSimulationTypes> ansys.dpf.post.common.AvailableSimulationTypes.

Parameters:
  • data_sources (str, ansys.dpf.core.DataSources) – Path to the file to open or the ansys.dpf.core.DataSources class.

  • simulation_type (Optional[AvailableSimulationTypes, str]], default: None) – Type of simulation to create when loading the specified data sources. Each type of simulation gives access to specific properties and methods to better fit expectations and vocabulary of each context. This defaults to the simulation type corresponding to the combination of physics type and analysis type detected automatically by DPF when reading the result files. If nothing is detected, this will default to a static mechanical type of simulation. The best practice is to define this parameter to select the right post-processing context. Options are given in <AvailableSimulationTypes> ansys.dpf.post.common.AvailableSimulationTypes.

  • server (Optional[BaseServer], default: None) – DPF server connected to a remote or local instance.

Return type:

TypeVar(SimulationType, bound= Simulation)

Returns:

  • An instance of one of the subclasses of the

  • Simulation class.

  • .. versionadded:: 3.0 – This function replaces the deprecated load_solution() function.

Examples

Load the example static result.

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> simulation = post.load_simulation(examples.static_rst)
ansys.dpf.post.post_utility.print_available_keywords()#

Print the keywords that can be used into the result object.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> solution = post.load_solution(examples.download_all_kinds_of_complexity())
>>> post.print_available_keywords() 
element_scoping: list, int or dpf.core.Scoping
grouping: str. Use post.grouping.(...) as helper.
location: str. Use post.locations.(...) as helper.
mapdl_grouping: int. Write 186 to get mapdl_elements solid_186.
named_selection: str. Name of named_selection.
node_scoping: list, int or dpf.core.Scoping
path: DpfPath object that
            contains a list of coordinates,
            e.g. [[0.1, 0.0, 0.0],
            [0.0, 0.1, 0.0]].
set: int
time: float
time_scoping: list, int or dpf.core.Scoping