create_particle_trace_from_line#

Parts.create_particle_trace_from_line(name: str, variable: str | int | ENS_VAR, point1: List[float], point2: List[float], 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) ENS_PART_PARTICLE_TRACE#

Create a particle trace part from a line. 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

point1: list

List of coordinates for point 1.

point2: list

List of coordinates for point 2.

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.

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.

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_line("mytraces", "Velocity", point1=[-0.02,-0.123,0.01576], point2=[0.109876,-0.123,0.0123], num_points=10, source_parts=parts.select_parts_by_dimension(3))