ansys-pyensight-core 0.7.2__tar.gz → 0.7.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansys-pyensight-core might be problematic. Click here for more details.
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/PKG-INFO +1 -1
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/pyproject.toml +1 -1
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/parts.py +209 -74
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/LICENSE +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/README.rst +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/__init__.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/deep_pixel_view.html +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/dockerlauncher.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/enscontext.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/enshell_grpc.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/ensight_grpc.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/ensobj.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/launch_ensight.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/launcher.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/listobj.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/locallauncher.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/py.typed +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/renderable.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/session.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/sgeo_poll.html +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/__init__.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/adr.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/export.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/query.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/support.py +0 -0
- {ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/views.py +0 -0
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/parts.py
RENAMED
|
@@ -26,12 +26,10 @@ except ImportError:
|
|
|
26
26
|
from ansys.pyensight.core.listobj import ensobjlist
|
|
27
27
|
|
|
28
28
|
if TYPE_CHECKING:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
from ansys.api.pyensight.ens_part import ENS_PART
|
|
34
|
-
from ansys.api.pyensight.ens_var import ENS_VAR
|
|
29
|
+
from ansys.api.pyensight import ensight_api
|
|
30
|
+
from ansys.api.pyensight.ens_part import ENS_PART
|
|
31
|
+
from ansys.api.pyensight.ens_part_particle_trace import ENS_PART_PARTICLE_TRACE
|
|
32
|
+
from ansys.api.pyensight.ens_var import ENS_VAR
|
|
35
33
|
|
|
36
34
|
|
|
37
35
|
def convert_part(
|
|
@@ -318,7 +316,7 @@ class Parts:
|
|
|
318
316
|
raise RuntimeError("No input provided to create the emitters for the particle trace")
|
|
319
317
|
return new_emitters
|
|
320
318
|
|
|
321
|
-
def
|
|
319
|
+
def _create_particle_trace_part(
|
|
322
320
|
self,
|
|
323
321
|
name: str,
|
|
324
322
|
variable: Union[str, int, "ENS_VAR"],
|
|
@@ -328,18 +326,22 @@ class Parts:
|
|
|
328
326
|
emit_time: Optional[float] = None,
|
|
329
327
|
total_time: Optional[float] = None,
|
|
330
328
|
delta_time: Optional[float] = None,
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
surface_restrict: Optional[bool] = False,
|
|
330
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
331
|
+
"""Private routine to create a particle trace part object"""
|
|
332
|
+
current_timestep = None
|
|
333
333
|
direction_map = {
|
|
334
334
|
self.PT_POS_TIME: self.ensight.objs.enums.POS_TIME,
|
|
335
335
|
self.PT_NEG_TIME: self.ensight.objs.enums.NEG_TIME,
|
|
336
336
|
self.PT_POS_NEG_TIME: self.ensight.objs.enums.POS_NEG_TIME,
|
|
337
337
|
}
|
|
338
338
|
idx = self.ensight.objs.enums.PART_PARTICLE_TRACE
|
|
339
|
-
def_part = self.ensight.objs.core.DEFAULTPARTS[idx]
|
|
339
|
+
def_part: "ENS_PART_PARTICLE_TRACE" = self.ensight.objs.core.DEFAULTPARTS[idx]
|
|
340
340
|
def_part.TYPE = self.ensight.objs.enums.STREAMLINE
|
|
341
341
|
if pathlines is True:
|
|
342
342
|
def_part.TYPE = self.ensight.objs.enums.PATHLINE
|
|
343
|
+
current_timestep = self.ensight.objs.core.TIMESTEP
|
|
344
|
+
self.ensight.objs.core.TIMESTEP = self.ensight.objs.core.TIMESTEP_LIMITS[0]
|
|
343
345
|
if total_time:
|
|
344
346
|
def_part.TOTALTIME = total_time
|
|
345
347
|
if delta_time:
|
|
@@ -350,22 +352,38 @@ class Parts:
|
|
|
350
352
|
def_part.VARIABLE = convert_variable(self.ensight, variable)
|
|
351
353
|
def_part.SURFACERESTRICTED = False
|
|
352
354
|
def_part.TRACEDIRECTION = direction_map.get(direction)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
355
|
+
if surface_restrict:
|
|
356
|
+
def_part.SURFACERESTRICTED = True
|
|
357
|
+
particle_trace_part: "ENS_PART_PARTICLE_TRACE" = def_part.createpart(
|
|
358
|
+
sources=source_parts, name=name
|
|
359
|
+
)[0]
|
|
360
|
+
if current_timestep:
|
|
361
|
+
self.ensight.objs.core.TIMESTEP = current_timestep
|
|
362
|
+
return particle_trace_part
|
|
363
|
+
|
|
364
|
+
def _add_emitters_to_particle_trace_part(
|
|
365
|
+
self,
|
|
366
|
+
particle_trace_part: "ENS_PART_PARTICLE_TRACE",
|
|
367
|
+
new_emitters: List[Any],
|
|
368
|
+
palette: Optional[str] = None,
|
|
369
|
+
clean: Optional[bool] = False,
|
|
370
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
371
|
+
"""Private utility to add emitters to an existing particle trace part."""
|
|
360
372
|
if isinstance(self.ensight, ModuleType):
|
|
361
|
-
|
|
373
|
+
if clean:
|
|
374
|
+
emitters = []
|
|
375
|
+
else:
|
|
376
|
+
emitters = particle_trace_part.EMITTERS.copy()
|
|
362
377
|
emitters.extend(new_emitters)
|
|
363
|
-
|
|
378
|
+
particle_trace_part.EMITTERS = emitters
|
|
364
379
|
else:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
380
|
+
if clean:
|
|
381
|
+
self.ensight._session.cmd("enscl.emitters=[]", do_eval=False)
|
|
382
|
+
else:
|
|
383
|
+
self.ensight._session.cmd(
|
|
384
|
+
f"enscl.emitters=ensight.objs.wrap_id({particle_trace_part.objid}).EMITTERS.copy()",
|
|
385
|
+
do_eval=False,
|
|
386
|
+
)
|
|
369
387
|
text = "enscl.emitters.extend(["
|
|
370
388
|
for emitter in new_emitters:
|
|
371
389
|
text += emitter + ", "
|
|
@@ -373,21 +391,26 @@ class Parts:
|
|
|
373
391
|
text += "])"
|
|
374
392
|
self.ensight._session.cmd(text, do_eval=False)
|
|
375
393
|
self.ensight._session.cmd(
|
|
376
|
-
f"ensight.objs.wrap_id({
|
|
394
|
+
f"ensight.objs.wrap_id({particle_trace_part.objid}).setattr('EMITTERS', enscl.emitters.copy())"
|
|
377
395
|
)
|
|
378
396
|
self.ensight._session.cmd("del enscl.emitters", do_eval=False)
|
|
379
397
|
if palette:
|
|
380
|
-
|
|
381
|
-
return
|
|
382
|
-
|
|
383
|
-
def
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
398
|
+
particle_trace_part.COLORBYPALETTE = palette
|
|
399
|
+
return particle_trace_part
|
|
400
|
+
|
|
401
|
+
def _cure_particle_trace_part(
|
|
402
|
+
self, particle_trace_part: Union[str, int, "ENS_PART_PARTICLE_TRACE"]
|
|
403
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
404
|
+
"""Private utility to cure an input particle trace part and convert it to an ``ENS_PART`"""
|
|
405
|
+
_particle_trace_part: "ENS_PART_PARTICLE_TRACE"
|
|
406
|
+
if isinstance(particle_trace_part, (str, int)):
|
|
407
|
+
temp = self.ensight.objs.core.PARTS[particle_trace_part]
|
|
387
408
|
if not temp:
|
|
388
|
-
raise RuntimeError("
|
|
389
|
-
|
|
390
|
-
|
|
409
|
+
raise RuntimeError("particle_trace_part input is not a valid part")
|
|
410
|
+
_particle_trace_part = temp[0]
|
|
411
|
+
else:
|
|
412
|
+
_particle_trace_part = particle_trace_part
|
|
413
|
+
return _particle_trace_part
|
|
391
414
|
|
|
392
415
|
def _prepare_particle_creation(
|
|
393
416
|
self,
|
|
@@ -405,6 +428,21 @@ class Parts:
|
|
|
405
428
|
raise RuntimeError("No part selected for particle trace generation")
|
|
406
429
|
return direction, converted_source_parts
|
|
407
430
|
|
|
431
|
+
def _find_palette(self, color_by: Optional[Union[str, int, "ENS_VAR"]] = None) -> Optional[str]:
|
|
432
|
+
"""Private utility to find the description of the input color_by variable"""
|
|
433
|
+
palette: Optional[str] = None
|
|
434
|
+
if color_by:
|
|
435
|
+
_color_by_var: List["ENS_VAR"] = ensight.objs.core.VARIABLES[
|
|
436
|
+
convert_variable(self.ensight, color_by)
|
|
437
|
+
]
|
|
438
|
+
if _color_by_var:
|
|
439
|
+
palette = _color_by_var[0].DESCRIPTION
|
|
440
|
+
else:
|
|
441
|
+
raise RuntimeError(
|
|
442
|
+
"The variable supplied to color the particle trace by does not exist"
|
|
443
|
+
)
|
|
444
|
+
return palette
|
|
445
|
+
|
|
408
446
|
def create_particle_trace_from_points(
|
|
409
447
|
self,
|
|
410
448
|
name: str,
|
|
@@ -416,7 +454,8 @@ class Parts:
|
|
|
416
454
|
emit_time: Optional[float] = None,
|
|
417
455
|
total_time: Optional[float] = None,
|
|
418
456
|
delta_time: Optional[float] = None,
|
|
419
|
-
|
|
457
|
+
color_by: Optional[Union[str, int, "ENS_VAR"]] = None,
|
|
458
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
420
459
|
"""
|
|
421
460
|
Create a particle trace part from a list o points.
|
|
422
461
|
Returns the ``ENS_PART`` generated.
|
|
@@ -459,12 +498,23 @@ class Parts:
|
|
|
459
498
|
delta_time: float
|
|
460
499
|
The interval for the emissions. If not provided, EnSight will provide
|
|
461
500
|
a best estimate.
|
|
501
|
+
color_by
|
|
502
|
+
The optional variable to color the particle trace by.
|
|
503
|
+
It can be the name, the ID or the ``ENS_VAR`` object.
|
|
504
|
+
|
|
505
|
+
Examples
|
|
506
|
+
--------
|
|
507
|
+
>>> s = LocalLauncher().start()
|
|
508
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
509
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
510
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
511
|
+
>>> s.ensight.utils.parts.create_particle_trace_from_points("mytraces", "Velocity", points=[[-0.02,-0.123,0.01576],[0.109876,-0.123,0.0123]], source_parts=parts.select_parts_by_dimension(3))
|
|
462
512
|
"""
|
|
463
513
|
emitter_type = self._EMIT_POINT
|
|
464
514
|
direction, converted_source_parts = self._prepare_particle_creation(
|
|
465
515
|
direction=direction, source_parts=source_parts
|
|
466
516
|
)
|
|
467
|
-
|
|
517
|
+
particle_trace_part = self._create_particle_trace_part(
|
|
468
518
|
name,
|
|
469
519
|
variable,
|
|
470
520
|
direction,
|
|
@@ -475,8 +525,9 @@ class Parts:
|
|
|
475
525
|
total_time=total_time,
|
|
476
526
|
)
|
|
477
527
|
new_emitters = self._create_emitters(emitter_type=emitter_type, points=points)
|
|
478
|
-
|
|
479
|
-
|
|
528
|
+
palette = self._find_palette(color_by=color_by)
|
|
529
|
+
return self._add_emitters_to_particle_trace_part(
|
|
530
|
+
particle_trace_part, new_emitters=new_emitters, palette=palette, clean=True
|
|
480
531
|
)
|
|
481
532
|
|
|
482
533
|
def create_particle_trace_from_line(
|
|
@@ -492,7 +543,8 @@ class Parts:
|
|
|
492
543
|
emit_time: Optional[float] = None,
|
|
493
544
|
total_time: Optional[float] = None,
|
|
494
545
|
delta_time: Optional[float] = None,
|
|
495
|
-
|
|
546
|
+
color_by: Optional[Union[str, int, "ENS_VAR"]] = None,
|
|
547
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
496
548
|
"""
|
|
497
549
|
Create a particle trace part from a line.
|
|
498
550
|
Returns the ``ENS_PART`` generated.
|
|
@@ -539,12 +591,24 @@ class Parts:
|
|
|
539
591
|
delta_time: float
|
|
540
592
|
The interval for the emissions. If not provided, EnSight will provide
|
|
541
593
|
a best estimate.
|
|
594
|
+
color_by
|
|
595
|
+
The optional variable to color the particle trace by.
|
|
596
|
+
It can be the name, the ID or the ``ENS_VAR`` object.
|
|
597
|
+
|
|
598
|
+
Examples
|
|
599
|
+
--------
|
|
600
|
+
>>> s = LocalLauncher().start()
|
|
601
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
602
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
603
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
604
|
+
>>> parts = s.ensight.utils.parts
|
|
605
|
+
>>> 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))
|
|
542
606
|
"""
|
|
543
607
|
emitter_type = self._EMIT_LINE
|
|
544
608
|
direction, converted_source_parts = self._prepare_particle_creation(
|
|
545
609
|
direction=direction, source_parts=source_parts
|
|
546
610
|
)
|
|
547
|
-
|
|
611
|
+
particle_trace_part = self._create_particle_trace_part(
|
|
548
612
|
name,
|
|
549
613
|
variable,
|
|
550
614
|
direction,
|
|
@@ -557,8 +621,9 @@ class Parts:
|
|
|
557
621
|
new_emitters = self._create_emitters(
|
|
558
622
|
emitter_type=emitter_type, point1=point1, point2=point2, num_points=num_points
|
|
559
623
|
)
|
|
560
|
-
|
|
561
|
-
|
|
624
|
+
palette = self._find_palette(color_by=color_by)
|
|
625
|
+
return self._add_emitters_to_particle_trace_part(
|
|
626
|
+
particle_trace_part, new_emitters=new_emitters, palette=palette, clean=True
|
|
562
627
|
)
|
|
563
628
|
|
|
564
629
|
def create_particle_trace_from_plane(
|
|
@@ -576,7 +641,8 @@ class Parts:
|
|
|
576
641
|
emit_time: Optional[float] = None,
|
|
577
642
|
total_time: Optional[float] = None,
|
|
578
643
|
delta_time: Optional[float] = None,
|
|
579
|
-
|
|
644
|
+
color_by: Optional[Union[str, int, "ENS_VAR"]] = None,
|
|
645
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
580
646
|
"""
|
|
581
647
|
Create a particle trace part from a plane.
|
|
582
648
|
Returns the ``ENS_PART`` generated.
|
|
@@ -629,12 +695,24 @@ class Parts:
|
|
|
629
695
|
delta_time: float
|
|
630
696
|
The interval for the emissions. If not provided, EnSight will provide
|
|
631
697
|
a best estimate.
|
|
698
|
+
color_by
|
|
699
|
+
The optional variable to color the particle trace by.
|
|
700
|
+
It can be the name, the ID or the ``ENS_VAR`` object.
|
|
701
|
+
|
|
702
|
+
Examples
|
|
703
|
+
--------
|
|
704
|
+
>>> s = LocalLauncher().start()
|
|
705
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
706
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
707
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
708
|
+
>>> parts = s.ensight.utils.parts
|
|
709
|
+
>>> parts.create_particle_trace_from_plane("mytraces", "Velocity", point1=[-0.02,-0.123,0.01576], point2=[0.109876,-0.123,0.0123], point3=[0.1, 0, 0.05] ,num_points_x=10, num_points_y=10, source_parts=parts.select_parts_by_dimension(3))
|
|
632
710
|
"""
|
|
633
711
|
emitter_type = self._EMIT_PLANE
|
|
634
712
|
direction, converted_source_parts = self._prepare_particle_creation(
|
|
635
713
|
direction=direction, source_parts=source_parts
|
|
636
714
|
)
|
|
637
|
-
|
|
715
|
+
particle_trace_part = self._create_particle_trace_part(
|
|
638
716
|
name,
|
|
639
717
|
variable,
|
|
640
718
|
direction,
|
|
@@ -652,8 +730,9 @@ class Parts:
|
|
|
652
730
|
num_points_x=num_points_x,
|
|
653
731
|
num_points_y=num_points_y,
|
|
654
732
|
)
|
|
655
|
-
|
|
656
|
-
|
|
733
|
+
palette = self._find_palette(color_by=color_by)
|
|
734
|
+
return self._add_emitters_to_particle_trace_part(
|
|
735
|
+
particle_trace_part, new_emitters=new_emitters, palette=palette, clean=True
|
|
657
736
|
)
|
|
658
737
|
|
|
659
738
|
def create_particle_trace_from_parts(
|
|
@@ -669,7 +748,9 @@ class Parts:
|
|
|
669
748
|
emit_time: Optional[float] = None,
|
|
670
749
|
total_time: Optional[float] = None,
|
|
671
750
|
delta_time: Optional[float] = None,
|
|
672
|
-
|
|
751
|
+
color_by: Optional[Union[str, int, "ENS_VAR"]] = None,
|
|
752
|
+
surface_restrict: Optional[bool] = False,
|
|
753
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
673
754
|
"""
|
|
674
755
|
Create a particle trace part from a list of seed parts.
|
|
675
756
|
Returns the ``ENS_PART`` generated.
|
|
@@ -728,12 +809,28 @@ class Parts:
|
|
|
728
809
|
delta_time: float
|
|
729
810
|
The interval for the emissions. If not provided, EnSight will provide
|
|
730
811
|
a best estimate.
|
|
812
|
+
color_by
|
|
813
|
+
The optional variable to color the particle trace by.
|
|
814
|
+
It can be the name, the ID or the ``ENS_VAR`` object.
|
|
815
|
+
surface_restrict: bool
|
|
816
|
+
True if the particle trace needs to be restricted to the input parts.
|
|
817
|
+
Defaults to False. The flag will be applied to any additional emitter
|
|
818
|
+
appended to the particle trace created.
|
|
819
|
+
|
|
820
|
+
Examples
|
|
821
|
+
--------
|
|
822
|
+
>>> s = LocalLauncher().start()
|
|
823
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
824
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
825
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
826
|
+
>>> parts = s.ensight.utils.parts
|
|
827
|
+
>>> parts.create_particle_trace_from_parts("mytraces", "Velocity", parts=["hot-inlet", "cold-inlet"], num_points=100 source_parts=parts.select_parts_by_dimension(3))
|
|
731
828
|
"""
|
|
732
829
|
emitter_type = self._EMIT_PART
|
|
733
830
|
direction, converted_source_parts = self._prepare_particle_creation(
|
|
734
831
|
direction=direction, source_parts=source_parts
|
|
735
832
|
)
|
|
736
|
-
|
|
833
|
+
particle_trace_part = self._create_particle_trace_part(
|
|
737
834
|
name,
|
|
738
835
|
variable,
|
|
739
836
|
direction,
|
|
@@ -742,6 +839,7 @@ class Parts:
|
|
|
742
839
|
emit_time=emit_time,
|
|
743
840
|
delta_time=delta_time,
|
|
744
841
|
total_time=total_time,
|
|
842
|
+
surface_restrict=surface_restrict,
|
|
745
843
|
)
|
|
746
844
|
new_parts = [convert_part(self.ensight, p) for p in parts]
|
|
747
845
|
new_emitters = self._create_emitters(
|
|
@@ -750,15 +848,16 @@ class Parts:
|
|
|
750
848
|
part_distribution_type=part_distribution_type,
|
|
751
849
|
num_points=num_points,
|
|
752
850
|
)
|
|
753
|
-
|
|
754
|
-
|
|
851
|
+
palette = self._find_palette(color_by=color_by)
|
|
852
|
+
return self._add_emitters_to_particle_trace_part(
|
|
853
|
+
particle_trace_part, new_emitters=new_emitters, palette=palette, clean=True
|
|
755
854
|
)
|
|
756
855
|
|
|
757
|
-
def
|
|
856
|
+
def add_emitter_points_to_particle_trace_part(
|
|
758
857
|
self,
|
|
759
|
-
|
|
858
|
+
particle_trace_part: Union[str, int, "ENS_PART"],
|
|
760
859
|
points: List[List[float]],
|
|
761
|
-
) -> "
|
|
860
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
762
861
|
"""
|
|
763
862
|
Add point emitters to an existing particle trace. The function will return the updated
|
|
764
863
|
``ENS_PART`` object.
|
|
@@ -766,24 +865,33 @@ class Parts:
|
|
|
766
865
|
Parameters:
|
|
767
866
|
-----------
|
|
768
867
|
|
|
769
|
-
|
|
868
|
+
particle_trace_part:
|
|
770
869
|
The particle trace part to be added emitters to.
|
|
771
870
|
Can be the name, the ID or the ``ENS_PART`` object
|
|
772
871
|
points: list
|
|
773
872
|
List of list containing the coordinates for the seed points.
|
|
873
|
+
|
|
874
|
+
Examples
|
|
875
|
+
--------
|
|
876
|
+
>>> s = LocalLauncher().start()
|
|
877
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
878
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
879
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
880
|
+
>>> p = s.ensight.utils.parts.create_particle_trace_from_points("mytraces", "Velocity", points=[[-0.02, -0.123, 0.01576]], source_parts=parts.select_parts_by_dimension(3))
|
|
881
|
+
>>> p = s.ensight.utils.parts.add_emitter_points_to_particle_trace_part(p, points=[[0.109876, -0.123, 0.0123]])
|
|
774
882
|
"""
|
|
775
883
|
emitter_type = self._EMIT_POINT
|
|
776
|
-
|
|
884
|
+
particle_trace_part = self._cure_particle_trace_part(particle_trace_part)
|
|
777
885
|
new_emitters = self._create_emitters(emitter_type=emitter_type, points=points)
|
|
778
|
-
return self.
|
|
886
|
+
return self._add_emitters_to_particle_trace_part(particle_trace_part, new_emitters)
|
|
779
887
|
|
|
780
|
-
def
|
|
888
|
+
def add_emitter_line_to_particle_trace_part(
|
|
781
889
|
self,
|
|
782
|
-
|
|
890
|
+
particle_trace_part: Union[str, int, "ENS_PART"],
|
|
783
891
|
point1: List[float],
|
|
784
892
|
point2: List[float],
|
|
785
893
|
num_points: Optional[int] = 100,
|
|
786
|
-
):
|
|
894
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
787
895
|
"""
|
|
788
896
|
Add a line emitter to an existing particle trace. The function will return the updated
|
|
789
897
|
``ENS_PART`` object.
|
|
@@ -791,7 +899,7 @@ class Parts:
|
|
|
791
899
|
Parameters:
|
|
792
900
|
-----------
|
|
793
901
|
|
|
794
|
-
|
|
902
|
+
particle_trace_part:
|
|
795
903
|
The particle trace part to be added emitters to.
|
|
796
904
|
Can be the name, the ID or the ``ENS_PART`` object.
|
|
797
905
|
point1: list
|
|
@@ -800,23 +908,32 @@ class Parts:
|
|
|
800
908
|
The coordinates for point 2.
|
|
801
909
|
num_points: int
|
|
802
910
|
The number of seed points. Defaults to 100.
|
|
911
|
+
|
|
912
|
+
Examples
|
|
913
|
+
--------
|
|
914
|
+
>>> s = LocalLauncher().start()
|
|
915
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
916
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
917
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
918
|
+
>>> p = s.ensight.utils.parts.create_particle_trace_from_points("mytraces", "Velocity", points=[[-0.02,-0.123,0.01576]], source_parts=parts.select_parts_by_dimension(3))
|
|
919
|
+
>>> p = s.ensight.utils.parts.add_emitter_line_to_particle_trace_part(p, point1=[-0.02, -0.123, 0.01576], point2=[0.109876, -0.123, 0.0123], num_points=10)
|
|
803
920
|
"""
|
|
804
921
|
emitter_type = self._EMIT_LINE
|
|
805
|
-
|
|
922
|
+
particle_trace_part = self._cure_particle_trace_part(particle_trace_part)
|
|
806
923
|
new_emitters = self._create_emitters(
|
|
807
924
|
emitter_type=emitter_type, point1=point1, point2=point2, num_points=num_points
|
|
808
925
|
)
|
|
809
|
-
return self.
|
|
926
|
+
return self._add_emitters_to_particle_trace_part(particle_trace_part, new_emitters)
|
|
810
927
|
|
|
811
|
-
def
|
|
928
|
+
def add_emitter_plane_to_particle_trace_part(
|
|
812
929
|
self,
|
|
813
|
-
|
|
930
|
+
particle_trace_part: Union[str, int, "ENS_PART"],
|
|
814
931
|
point1: List[float],
|
|
815
932
|
point2: List[float],
|
|
816
933
|
point3: List[float],
|
|
817
934
|
num_points_x: Optional[int] = 25,
|
|
818
935
|
num_points_y: Optional[int] = 25,
|
|
819
|
-
):
|
|
936
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
820
937
|
"""
|
|
821
938
|
Add a plane emitter to an existing particle trace. The function will return the updated
|
|
822
939
|
``ENS_PART`` object.
|
|
@@ -824,7 +941,7 @@ class Parts:
|
|
|
824
941
|
Parameters:
|
|
825
942
|
-----------
|
|
826
943
|
|
|
827
|
-
|
|
944
|
+
particle_trace_part:
|
|
828
945
|
The particle trace part to be added emitters to.
|
|
829
946
|
Can be the name, the ID or the ``ENS_PART`` object.
|
|
830
947
|
point1: list
|
|
@@ -839,9 +956,18 @@ class Parts:
|
|
|
839
956
|
num_points_y: int
|
|
840
957
|
The number of points on the ``Y`` direction of the emission plane.
|
|
841
958
|
Defaults to 25.
|
|
959
|
+
|
|
960
|
+
Examples
|
|
961
|
+
--------
|
|
962
|
+
>>> s = LocalLauncher().start()
|
|
963
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
964
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
965
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
966
|
+
>>> p = s.ensight.utils.parts.create_particle_trace_from_points("mytraces", "Velocity", points=[[-0.02,-0.123,0.01576]], source_parts=parts.select_parts_by_dimension(3))
|
|
967
|
+
>>> p = s.ensight.utils.parts.add_emitter_plane_to_particle_trace_part(p, point1=[-0.02, -0.123, 0.01576], point2=[0.109876, -0.123, 0.0123], point3=[0.1, 0, 0.05], num_points_x=10, num_points_y=10)
|
|
842
968
|
"""
|
|
843
969
|
emitter_type = self._EMIT_PLANE
|
|
844
|
-
|
|
970
|
+
particle_trace_part = self._cure_particle_trace_part(particle_trace_part)
|
|
845
971
|
new_emitters = self._create_emitters(
|
|
846
972
|
emitter_type=emitter_type,
|
|
847
973
|
point1=point1,
|
|
@@ -850,15 +976,15 @@ class Parts:
|
|
|
850
976
|
num_points_x=num_points_x,
|
|
851
977
|
num_points_y=num_points_y,
|
|
852
978
|
)
|
|
853
|
-
return self.
|
|
979
|
+
return self._add_emitters_to_particle_trace_part(particle_trace_part, new_emitters)
|
|
854
980
|
|
|
855
|
-
def
|
|
981
|
+
def add_emitter_parts_to_particle_trace_part(
|
|
856
982
|
self,
|
|
857
|
-
|
|
983
|
+
particle_trace_part: Union[str, int, "ENS_PART"],
|
|
858
984
|
parts: List[Union[str, int, "ENS_PART"]],
|
|
859
985
|
part_distribution_type: Optional[int] = 0,
|
|
860
986
|
num_points: Optional[int] = 100,
|
|
861
|
-
):
|
|
987
|
+
) -> "ENS_PART_PARTICLE_TRACE":
|
|
862
988
|
"""
|
|
863
989
|
Add a list of part emitters to an existing particle trace. The function will return the updated
|
|
864
990
|
``ENS_PART`` object.
|
|
@@ -866,7 +992,7 @@ class Parts:
|
|
|
866
992
|
Parameters:
|
|
867
993
|
-----------
|
|
868
994
|
|
|
869
|
-
|
|
995
|
+
particle_trace_part:
|
|
870
996
|
The particle trace part to be added emitters to.
|
|
871
997
|
Can be the name, the ID or the ``ENS_PART`` object.
|
|
872
998
|
parts: list
|
|
@@ -887,9 +1013,18 @@ class Parts:
|
|
|
887
1013
|
num_points: int
|
|
888
1014
|
The number of points to emit from.
|
|
889
1015
|
Defaults to 100.
|
|
1016
|
+
|
|
1017
|
+
Examples
|
|
1018
|
+
--------
|
|
1019
|
+
>>> s = LocalLauncher().start()
|
|
1020
|
+
>>> cas_file = s.download_pyansys_example("mixing_elbow.cas.h5","pyfluent/mixing_elbow")
|
|
1021
|
+
>>> dat_file = s.download_pyansys_example("mixing_elbow.dat.h5","pyfluent/mixing_elbow")
|
|
1022
|
+
>>> s.load_data(cas_file, result_file=dat_file)
|
|
1023
|
+
>>> p = s.ensight.utils.parts.create_particle_trace_from_points("mytraces", "Velocity", points=[[-0.02, -0.123, 0.01576]], source_parts=parts.select_parts_by_dimension(3))
|
|
1024
|
+
>>> p = s.ensight.utils.parts.add_emitter_parts_to_particle_trace_part(p, parts=["cold-inlet", "hot-inlet"], num_points=25)
|
|
890
1025
|
"""
|
|
891
1026
|
emitter_type = self._EMIT_PART
|
|
892
|
-
|
|
1027
|
+
particle_trace_part = self._cure_particle_trace_part(particle_trace_part)
|
|
893
1028
|
new_parts = [convert_part(self.ensight, p) for p in parts]
|
|
894
1029
|
new_emitters = self._create_emitters(
|
|
895
1030
|
emitter_type=emitter_type,
|
|
@@ -897,4 +1032,4 @@ class Parts:
|
|
|
897
1032
|
part_distribution_type=part_distribution_type,
|
|
898
1033
|
num_points=num_points,
|
|
899
1034
|
)
|
|
900
|
-
return self.
|
|
1035
|
+
return self._add_emitters_to_particle_trace_part(particle_trace_part, new_emitters)
|
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/dockerlauncher.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/enscontext.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/enshell_grpc.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/ensight_grpc.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/ensobj.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/launch_ensight.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/launcher.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/listobj.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/locallauncher.py
RENAMED
|
File without changes
|
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/renderable.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/session.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/sgeo_poll.html
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/__init__.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/adr.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/export.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/query.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/support.py
RENAMED
|
File without changes
|
{ansys_pyensight_core-0.7.2 → ansys_pyensight_core-0.7.3}/src/ansys/pyensight/core/utils/views.py
RENAMED
|
File without changes
|