create_particle_trace_from_parts#

Parts.create_particle_trace_from_parts(name: str, variable: str | int | ENS_VAR, parts: List[str | int | ENS_PART], part_distribution_type: int | None = 0, num_points: int | None = 100, direction: str | None = None, pathlines: bool | None = False, source_parts: List[str | int | ENS_PART] | None = None, emit_time: float | None = None, total_time: float | None = None, delta_time: float | None = None, color_by: str | int | ENS_VAR | None = None, surface_restrict: bool | None = False) ENS_PART_PARTICLE_TRACE#

Create a particle trace part from a list of seed parts. Returns the ENS_PART generated.

Parameters:
name: str

The name of part to be generated

variable:

The variable to compute the particle traces with. It can be the name, the ID or the ENS_VAR object. It must be a vector variable.

direction: str

The direction for the particle traces to be generated. This table describes the options:

Name

Query type

PT_POS_TIME

Follow the vector direction

PT_NEG_TIME

Go contrary to the vector direction

PT_POS_NEG_TIME

Follow and go contrary to the vector direction

If not provided, it will default to PT_POS_TIME

pathlines: bool

True if the particle traces need to be pathlines

source_parts: list

A list of parts to create the particle trace in. For instance, in a CFD simulation this might be the fluid zone. If not provided, the function will try to look for the selected parts.

parts: list

A list of parts to emit the particle traces from. They can be their names, their IDs or the respective ENS_PART objects.

part_distribution_type: int

The distribution of emitters in case of emission from a part. This table describes the options:

Name

Query type

PART_EMIT_FROM_NODES

Emit from the nodes of the part

PART_EMIT_FROM_AREA

Create an area of equidistant points for emission

If not provided, it will default to PART_EMIT_FROM_NODES

num_points: int

The number of points to emit from. Defaults to 100.

emit_time: float

The emission time to start the particle trace from. If not provided, it will use the current time.

total_time: float

The total emission time. If not provided, EnSight will provide the end time for a transient simulation, an internal best time for steady state simulations.

delta_time: float

The interval for the emissions. If not provided, EnSight will provide a best estimate.

color_by

The optional variable to color the particle trace by. It can be the name, the ID or the ENS_VAR object.

surface_restrict: bool

True if the particle trace needs to be restricted to the input parts. Defaults to False. The flag will be applied to any additional emitter appended to the particle trace created.

Examples

>>> s = LocalLauncher().start()
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
>>> s.load_data(cas_file, result_file=dat_file)
>>> parts = s.ensight.utils.parts
>>> parts.create_particle_trace_from_parts("mytraces", "Velocity", parts=["hot-inlet", "cold-inlet"], num_points=100 source_parts=parts.select_parts_by_dimension(3))