ansys-pyensight-core 0.7.8__py3-none-any.whl → 0.7.10__py3-none-any.whl
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/__init__.py +1 -1
- ansys/pyensight/core/dockerlauncher.py +52 -44
- ansys/pyensight/core/enscontext.py +17 -15
- ansys/pyensight/core/enshell_grpc.py +8 -8
- ansys/pyensight/core/ensight_grpc.py +37 -35
- ansys/pyensight/core/ensobj.py +4 -4
- ansys/pyensight/core/launch_ensight.py +2 -2
- ansys/pyensight/core/launcher.py +4 -4
- ansys/pyensight/core/listobj.py +18 -16
- ansys/pyensight/core/renderable.py +803 -798
- ansys/pyensight/core/session.py +33 -29
- ansys/pyensight/core/utils/export.py +9 -9
- ansys/pyensight/core/utils/omniverse_dsg_server.py +1 -0
- ansys/pyensight/core/utils/parts.py +50 -36
- ansys/pyensight/core/utils/query.py +41 -35
- ansys/pyensight/core/utils/variables.py +158 -139
- ansys/pyensight/core/utils/views.py +14 -14
- {ansys_pyensight_core-0.7.8.dist-info → ansys_pyensight_core-0.7.10.dist-info}/METADATA +2 -2
- ansys_pyensight_core-0.7.10.dist-info/RECORD +34 -0
- ansys_pyensight_core-0.7.8.dist-info/RECORD +0 -34
- {ansys_pyensight_core-0.7.8.dist-info → ansys_pyensight_core-0.7.10.dist-info}/LICENSE +0 -0
- {ansys_pyensight_core-0.7.8.dist-info → ansys_pyensight_core-0.7.10.dist-info}/WHEEL +0 -0
|
@@ -7,6 +7,7 @@ import math
|
|
|
7
7
|
import os
|
|
8
8
|
from typing import TYPE_CHECKING, Dict, List, Optional, Union
|
|
9
9
|
|
|
10
|
+
from ansys.api.pyensight.calc_funcs import ens_calculator
|
|
10
11
|
from ansys.pyensight.core.utils.parts import convert_variable
|
|
11
12
|
import numpy as np
|
|
12
13
|
|
|
@@ -49,6 +50,12 @@ class Variables:
|
|
|
49
50
|
|
|
50
51
|
def __init__(self, ensight: Union["ensight_api.ensight", "ensight"]):
|
|
51
52
|
self.ensight = ensight
|
|
53
|
+
self._calculator = ens_calculator(self.ensight)
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def calculator(self) -> "ens_calculator":
|
|
57
|
+
"""Return the instance of the calculator functions class"""
|
|
58
|
+
return self._calculator
|
|
52
59
|
|
|
53
60
|
def _check_for_var_elem(
|
|
54
61
|
self, var_name: str, pobj_list: List["ENS_PART"]
|
|
@@ -77,8 +84,8 @@ class Variables:
|
|
|
77
84
|
# within the list of parts used to calc var
|
|
78
85
|
# if NOT then return None
|
|
79
86
|
for prt in pobj_list:
|
|
80
|
-
if prt not in var.PARTS:
|
|
81
|
-
return None
|
|
87
|
+
if prt not in var.PARTS: # pragma: no cover
|
|
88
|
+
return None # pragma: no cover
|
|
82
89
|
return var
|
|
83
90
|
return None
|
|
84
91
|
|
|
@@ -153,11 +160,11 @@ class Variables:
|
|
|
153
160
|
err = -1
|
|
154
161
|
if not pobj_list or not calc_string:
|
|
155
162
|
return False
|
|
156
|
-
if len(calc_string) > 0 and len(pobj_list) > 0:
|
|
163
|
+
if len(calc_string) > 0 and len(pobj_list) > 0: # pragma: no cover
|
|
157
164
|
self.ensight.utils.parts.select_parts(pobj_list)
|
|
158
165
|
err = self.ensight.variables.evaluate(calc_string) # ,record=1)
|
|
159
|
-
if err != 0:
|
|
160
|
-
err_string = "Error calculating " + calc_string
|
|
166
|
+
if err != 0: # pragma: no cover
|
|
167
|
+
err_string = "Error calculating " + calc_string # pragma: no cover
|
|
161
168
|
raise RuntimeError(err_string) # pragma: no cover
|
|
162
169
|
return err == 0
|
|
163
170
|
|
|
@@ -250,15 +257,15 @@ class Variables:
|
|
|
250
257
|
#
|
|
251
258
|
_pobj_list: List["ENS_PART"]
|
|
252
259
|
_pobj_list = self.ensight.utils.parts.select_parts(pobj_list)
|
|
253
|
-
if not _pobj_list:
|
|
254
|
-
return False
|
|
260
|
+
if not _pobj_list: # pragma: no cover
|
|
261
|
+
return False # pragma: no cover
|
|
255
262
|
#
|
|
256
263
|
# can be using shear force or shear stress
|
|
257
264
|
#
|
|
258
|
-
if shear_or_force_flag == "Shear stress":
|
|
265
|
+
if shear_or_force_flag == "Shear stress": # pragma: no cover
|
|
259
266
|
stemp_string = "Stress"
|
|
260
|
-
else:
|
|
261
|
-
stemp_string = "Force"
|
|
267
|
+
else: # pragma: no cover
|
|
268
|
+
stemp_string = "Force" # pragma: no cover
|
|
262
269
|
# create a surface normal vector variable using the
|
|
263
270
|
# "Normal" function in the variable calculator.
|
|
264
271
|
#
|
|
@@ -271,14 +278,14 @@ class Variables:
|
|
|
271
278
|
#
|
|
272
279
|
new_shear_var_obj: "ENS_VAR"
|
|
273
280
|
shear_var_name: str
|
|
274
|
-
if _shear_var_obj.LOCATION != self.ensight.objs.enums.ENS_VAR_ELEM:
|
|
281
|
+
if _shear_var_obj.LOCATION != self.ensight.objs.enums.ENS_VAR_ELEM: # pragma: no cover
|
|
275
282
|
# tricks for mypy
|
|
276
283
|
values = self._move_var_to_elem(_pobj_list, _shear_var_obj)
|
|
277
284
|
ensvar_values = [v for v in values]
|
|
278
285
|
new_shear_var_obj = ensvar_values[0]
|
|
279
286
|
shear_var_name = new_shear_var_obj.DESCRIPTION
|
|
280
|
-
else:
|
|
281
|
-
shear_var_name = _shear_var_obj.DESCRIPTION
|
|
287
|
+
else: # pragma: no cover
|
|
288
|
+
shear_var_name = _shear_var_obj.DESCRIPTION # pragma: no cover
|
|
282
289
|
|
|
283
290
|
#
|
|
284
291
|
# Compute the Dot product of the Vector Normal and the FluidShearVector
|
|
@@ -357,7 +364,7 @@ class Variables:
|
|
|
357
364
|
#
|
|
358
365
|
# Calculate the Tangential Shear stress forces by multiplying each of the
|
|
359
366
|
# Components of the Tangential Shear stress with Element Size scalar.
|
|
360
|
-
if shear_or_force_flag == "Shear stress":
|
|
367
|
+
if shear_or_force_flag == "Shear stress": # pragma: no cover
|
|
361
368
|
#
|
|
362
369
|
# Calculate the element area Scalar using the "EleSize function in the Variable Calculator
|
|
363
370
|
#
|
|
@@ -390,19 +397,19 @@ class Variables:
|
|
|
390
397
|
return False # pragma: no cover
|
|
391
398
|
|
|
392
399
|
else:
|
|
393
|
-
temp_string = (
|
|
400
|
+
temp_string = ( # pragma: no cover
|
|
394
401
|
"ENS_Force_Tan_ShearForce_X = ENS_Force_TangentialShear" + stemp_string + "_X"
|
|
395
402
|
)
|
|
396
403
|
if not self._calc_var(_pobj_list, temp_string): # pragma: no cover
|
|
397
404
|
return False # pragma: no cover
|
|
398
405
|
|
|
399
|
-
temp_string = (
|
|
406
|
+
temp_string = ( # pragma: no cover
|
|
400
407
|
"ENS_Force_Tan_ShearForce_Y = ENS_Force_TangentialShear" + stemp_string + "_Y"
|
|
401
408
|
)
|
|
402
409
|
if not self._calc_var(_pobj_list, temp_string): # pragma: no cover
|
|
403
410
|
return False # pragma: no cover
|
|
404
411
|
|
|
405
|
-
temp_string = (
|
|
412
|
+
temp_string = ( # pragma: no cover
|
|
406
413
|
"ENS_Force_Tan_ShearForce_Z = ENS_Force_TangentialShear" + stemp_string + "_Z"
|
|
407
414
|
)
|
|
408
415
|
if not self._calc_var(_pobj_list, temp_string): # pragma: no cover
|
|
@@ -508,38 +515,38 @@ class Variables:
|
|
|
508
515
|
Fy: List[float] = []
|
|
509
516
|
Fz: List[float] = []
|
|
510
517
|
val = self.get_const_val("ENS_Force_Net_Tan_ShearForce_X", pobj_list)
|
|
511
|
-
if not val:
|
|
512
|
-
return None
|
|
518
|
+
if not val: # pragma: no cover
|
|
519
|
+
return None # pragma: no cover
|
|
513
520
|
if val:
|
|
514
521
|
if isinstance(val, list):
|
|
515
522
|
for v in val:
|
|
516
|
-
if not v:
|
|
517
|
-
return None
|
|
523
|
+
if not v: # pragma: no cover
|
|
524
|
+
return None # pragma: no cover
|
|
518
525
|
Fx.append(v)
|
|
519
526
|
else:
|
|
520
527
|
return None
|
|
521
528
|
val = self.get_const_val("ENS_Force_Net_Tan_ShearForce_Y", pobj_list)
|
|
522
|
-
if not val:
|
|
523
|
-
return None
|
|
529
|
+
if not val: # pragma: no cover
|
|
530
|
+
return None # pragma: no cover
|
|
524
531
|
if val:
|
|
525
532
|
if isinstance(val, list):
|
|
526
533
|
for v in val:
|
|
527
|
-
if not v:
|
|
528
|
-
return None
|
|
534
|
+
if not v: # pragma: no cover
|
|
535
|
+
return None # pragma: no cover
|
|
529
536
|
Fy.append(v)
|
|
530
537
|
else:
|
|
531
538
|
return None
|
|
532
539
|
val = self.get_const_val("ENS_Force_Net_Tan_ShearForce_Z", pobj_list)
|
|
533
|
-
if not val:
|
|
534
|
-
return None
|
|
540
|
+
if not val: # pragma: no cover
|
|
541
|
+
return None # pragma: no cover
|
|
535
542
|
if val:
|
|
536
543
|
if isinstance(val, list):
|
|
537
544
|
for v in val:
|
|
538
|
-
if not v:
|
|
539
|
-
return None
|
|
545
|
+
if not v: # pragma: no cover
|
|
546
|
+
return None # pragma: no cover
|
|
540
547
|
Fz.append(v)
|
|
541
548
|
else:
|
|
542
|
-
return None
|
|
549
|
+
return None # pragma: no cover
|
|
543
550
|
#
|
|
544
551
|
# Calculate the Total Shear force X, Y, and Z , 10.2.0(d) now case constant variable
|
|
545
552
|
# Totals are a case constants. We don't do anything with these vars
|
|
@@ -621,38 +628,38 @@ class Variables:
|
|
|
621
628
|
Ft: List[float] = []
|
|
622
629
|
Fa: List[float] = []
|
|
623
630
|
val = self.get_const_val("ENS_Force_Net_Tan_ShearForce_R", pobj_list)
|
|
624
|
-
if not val:
|
|
625
|
-
return None
|
|
631
|
+
if not val: # pragma: no cover
|
|
632
|
+
return None # pragma: no cover
|
|
626
633
|
if val:
|
|
627
634
|
if isinstance(val, list):
|
|
628
635
|
for v in val:
|
|
629
|
-
if not v:
|
|
630
|
-
return None
|
|
636
|
+
if not v: # pragma: no cover
|
|
637
|
+
return None # pragma: no cover
|
|
631
638
|
Fr.append(v)
|
|
632
639
|
else:
|
|
633
|
-
return None
|
|
640
|
+
return None # pragma: no cover
|
|
634
641
|
val = self.get_const_val("ENS_Force_Net_Tan_ShearForce_T", pobj_list)
|
|
635
642
|
if not val:
|
|
636
|
-
return None
|
|
643
|
+
return None # pragma: no cover
|
|
637
644
|
if val:
|
|
638
645
|
if isinstance(val, list):
|
|
639
646
|
for v in val:
|
|
640
|
-
if not v:
|
|
641
|
-
return None
|
|
647
|
+
if not v: # pragma: no cover
|
|
648
|
+
return None # pragma: no cover
|
|
642
649
|
Ft.append(v)
|
|
643
650
|
else:
|
|
644
651
|
return None
|
|
645
652
|
val = self.get_const_val("ENS_Force_Net_Tan_ShearForce_A", pobj_list)
|
|
646
|
-
if not val:
|
|
647
|
-
return None
|
|
653
|
+
if not val: # pragma: no cover
|
|
654
|
+
return None # pragma: no cover
|
|
648
655
|
if val:
|
|
649
656
|
if isinstance(val, list):
|
|
650
657
|
for v in val:
|
|
651
|
-
if not v:
|
|
652
|
-
return None
|
|
658
|
+
if not v: # pragma: no cover
|
|
659
|
+
return None # pragma: no cover
|
|
653
660
|
Fa.append(v)
|
|
654
661
|
else:
|
|
655
|
-
return None
|
|
662
|
+
return None # pragma: no cover
|
|
656
663
|
if all([Fr, Fa, Ft, Fx, Fy, Fz]):
|
|
657
664
|
ret_val = []
|
|
658
665
|
for ii in range(len(pobj_list)):
|
|
@@ -795,8 +802,8 @@ class Variables:
|
|
|
795
802
|
self.ensight.variables.activate(const_name) # bug fixed 10.1.6(c)
|
|
796
803
|
|
|
797
804
|
if const_type == self.ensight.objs.enums.ENS_VAR_CONSTANT_PER_PART: # new in 10.2
|
|
798
|
-
if not part_list:
|
|
799
|
-
part_list = self.ensight.objs.core.PARTS
|
|
805
|
+
if not part_list: # pragma: no cover
|
|
806
|
+
part_list = self.ensight.objs.core.PARTS # pragma: no cover
|
|
800
807
|
|
|
801
808
|
plist = self.ensight.utils.parts.get_part_id_obj_name(part_list, "obj")
|
|
802
809
|
ret_val: List[Optional[float]] = []
|
|
@@ -804,12 +811,12 @@ class Variables:
|
|
|
804
811
|
for prt in plist:
|
|
805
812
|
if isinstance(prt, self.ensight.objs.ENS_PART):
|
|
806
813
|
val_dict = prt.get_values([const_name])
|
|
807
|
-
if val_dict:
|
|
814
|
+
if val_dict: # pragma: no cover
|
|
808
815
|
val = float(val_dict[const_name][0])
|
|
809
816
|
if undef_none and np.isclose(
|
|
810
817
|
val, self.ensight.Undefined, rtol=1e-6, atol=1e-16
|
|
811
818
|
):
|
|
812
|
-
ret_val.append(None)
|
|
819
|
+
ret_val.append(None) # pragma: no cover
|
|
813
820
|
else:
|
|
814
821
|
ret_val.append(val)
|
|
815
822
|
else: # pragma: no cover
|
|
@@ -827,8 +834,10 @@ class Variables:
|
|
|
827
834
|
# scope will be >= 0 if a command language global
|
|
828
835
|
# (0 if command language global and >0 if local to a file or loop)
|
|
829
836
|
if scope_val == -1 and type_val == 1: # EnSight constant and float
|
|
830
|
-
if undef_none and np.isclose(
|
|
831
|
-
|
|
837
|
+
if undef_none and np.isclose(
|
|
838
|
+
val, self.ensight.Undefined, rtol=1e-6, atol=1e-16
|
|
839
|
+
): # pragma: no cover
|
|
840
|
+
return None # pragma: no cover
|
|
832
841
|
else:
|
|
833
842
|
return val
|
|
834
843
|
else: # pragma: no cover
|
|
@@ -926,21 +935,21 @@ class Variables:
|
|
|
926
935
|
#
|
|
927
936
|
_pobj_list: List["ENS_PART"]
|
|
928
937
|
_pobj_list = self.ensight.utils.parts.select_parts(pobj_list)
|
|
929
|
-
if not _pobj_list:
|
|
930
|
-
return False
|
|
938
|
+
if not _pobj_list: # pragma: no cover
|
|
939
|
+
return False # pragma: no cover
|
|
931
940
|
#
|
|
932
941
|
# makes a new elem var if input var is nodal
|
|
933
942
|
#
|
|
934
943
|
new_pres_var_obj: "ENS_VAR"
|
|
935
944
|
press_var_name: str
|
|
936
|
-
if _press_var_obj.LOCATION != self.ensight.objs.enums.ENS_VAR_ELEM:
|
|
945
|
+
if _press_var_obj.LOCATION != self.ensight.objs.enums.ENS_VAR_ELEM: # pragma: no cover
|
|
937
946
|
# tricks for mypy
|
|
938
947
|
values = self._move_var_to_elem(_pobj_list, _press_var_obj)
|
|
939
948
|
ensvar_values = [v for v in values]
|
|
940
949
|
new_pres_var_obj = ensvar_values[0]
|
|
941
950
|
press_var_name = new_pres_var_obj.DESCRIPTION
|
|
942
951
|
else:
|
|
943
|
-
press_var_name = _press_var_obj.DESCRIPTION
|
|
952
|
+
press_var_name = _press_var_obj.DESCRIPTION # pragma: no cover
|
|
944
953
|
|
|
945
954
|
#
|
|
946
955
|
# Calculate the Force vector
|
|
@@ -1069,38 +1078,38 @@ class Variables:
|
|
|
1069
1078
|
Fy: List[float] = []
|
|
1070
1079
|
Fz: List[float] = []
|
|
1071
1080
|
val = self.get_const_val("ENS_Force_Net_press_X", pobj_list)
|
|
1072
|
-
if not val:
|
|
1073
|
-
return None
|
|
1081
|
+
if not val: # pragma: no cover
|
|
1082
|
+
return None # pragma: no cover
|
|
1074
1083
|
if val:
|
|
1075
1084
|
if isinstance(val, list):
|
|
1076
1085
|
for v in val:
|
|
1077
|
-
if not v:
|
|
1078
|
-
return None
|
|
1086
|
+
if not v: # pragma: no cover
|
|
1087
|
+
return None # pragma: no cover
|
|
1079
1088
|
Fx.append(v)
|
|
1080
1089
|
else:
|
|
1081
|
-
return None
|
|
1090
|
+
return None # pragma: no cover
|
|
1082
1091
|
val = self.get_const_val("ENS_Force_Net_press_Y", pobj_list)
|
|
1083
|
-
if not val:
|
|
1084
|
-
return None
|
|
1092
|
+
if not val: # pragma: no cover
|
|
1093
|
+
return None # pragma: no cover
|
|
1085
1094
|
if val:
|
|
1086
1095
|
if isinstance(val, list):
|
|
1087
1096
|
for v in val:
|
|
1088
|
-
if not v:
|
|
1089
|
-
return None
|
|
1097
|
+
if not v: # pragma: no cover
|
|
1098
|
+
return None # pragma: no cover
|
|
1090
1099
|
Fy.append(v)
|
|
1091
1100
|
else:
|
|
1092
|
-
return None
|
|
1101
|
+
return None # pragma: no cover
|
|
1093
1102
|
val = self.get_const_val("ENS_Force_Net_press_Z", pobj_list)
|
|
1094
|
-
if not val:
|
|
1095
|
-
return None
|
|
1103
|
+
if not val: # pragma: no cover
|
|
1104
|
+
return None # pragma: no cover
|
|
1096
1105
|
if val:
|
|
1097
1106
|
if isinstance(val, list):
|
|
1098
1107
|
for v in val:
|
|
1099
|
-
if not v:
|
|
1100
|
-
return None
|
|
1108
|
+
if not v: # pragma: no cover
|
|
1109
|
+
return None # pragma: no cover
|
|
1101
1110
|
Fz.append(v)
|
|
1102
1111
|
else:
|
|
1103
|
-
return None
|
|
1112
|
+
return None # pragma: no cover
|
|
1104
1113
|
#
|
|
1105
1114
|
#
|
|
1106
1115
|
# Fr, Ft, Fa
|
|
@@ -1158,38 +1167,38 @@ class Variables:
|
|
|
1158
1167
|
Ft: List[float] = []
|
|
1159
1168
|
Fa: List[float] = []
|
|
1160
1169
|
val = self.get_const_val("ENS_Force_Net_press_R", pobj_list)
|
|
1161
|
-
if not val:
|
|
1162
|
-
return None
|
|
1170
|
+
if not val: # pragma: no cover
|
|
1171
|
+
return None # pragma: no cover
|
|
1163
1172
|
if val:
|
|
1164
1173
|
if isinstance(val, list):
|
|
1165
1174
|
for v in val:
|
|
1166
|
-
if not v:
|
|
1167
|
-
return None
|
|
1175
|
+
if not v: # pragma: no cover
|
|
1176
|
+
return None # pragma: no cover
|
|
1168
1177
|
Fr.append(v)
|
|
1169
1178
|
else:
|
|
1170
|
-
return None
|
|
1179
|
+
return None # pragma: no cover
|
|
1171
1180
|
val = self.get_const_val("ENS_Force_Net_press_T", pobj_list)
|
|
1172
|
-
if not val:
|
|
1173
|
-
return None
|
|
1181
|
+
if not val: # pragma: no cover
|
|
1182
|
+
return None # pragma: no cover
|
|
1174
1183
|
if val:
|
|
1175
1184
|
if isinstance(val, list):
|
|
1176
1185
|
for v in val:
|
|
1177
|
-
if not v:
|
|
1178
|
-
return None
|
|
1186
|
+
if not v: # pragma: no cover
|
|
1187
|
+
return None # pragma: no cover
|
|
1179
1188
|
Ft.append(v)
|
|
1180
1189
|
else:
|
|
1181
|
-
return None
|
|
1190
|
+
return None # pragma: no cover
|
|
1182
1191
|
val = self.get_const_val("ENS_Force_Net_press_A", pobj_list)
|
|
1183
|
-
if not val:
|
|
1184
|
-
return None
|
|
1192
|
+
if not val: # pragma: no cover
|
|
1193
|
+
return None # pragma: no cover
|
|
1185
1194
|
if val:
|
|
1186
1195
|
if isinstance(val, list):
|
|
1187
1196
|
for v in val:
|
|
1188
|
-
if not v:
|
|
1189
|
-
return None
|
|
1197
|
+
if not v: # pragma: no cover
|
|
1198
|
+
return None # pragma: no cover
|
|
1190
1199
|
Fa.append(v)
|
|
1191
1200
|
else:
|
|
1192
|
-
return None
|
|
1201
|
+
return None # pragma: no cover
|
|
1193
1202
|
#
|
|
1194
1203
|
if all([Fr, Ft, Fz, Fx, Fy, Fz]):
|
|
1195
1204
|
ret_val = []
|
|
@@ -1207,7 +1216,7 @@ class Variables:
|
|
|
1207
1216
|
return ret_val
|
|
1208
1217
|
else: # pragma: no cover
|
|
1209
1218
|
err_string = "Error getting Fx, Fy, and/or Fz Pressure Net force per part constant values" # pragma: no cover # pragma: no cover
|
|
1210
|
-
raise RuntimeError(err_string)
|
|
1219
|
+
raise RuntimeError(err_string) # pragma: no cover
|
|
1211
1220
|
|
|
1212
1221
|
def _write_out_force_data(
|
|
1213
1222
|
self,
|
|
@@ -1326,7 +1335,7 @@ class Variables:
|
|
|
1326
1335
|
fp.write(
|
|
1327
1336
|
", Pressure Force Radial , Pressure Force Theta , Pressure Force Axial, Total Cyl Pressure Force "
|
|
1328
1337
|
)
|
|
1329
|
-
if shear_force_list:
|
|
1338
|
+
if shear_force_list: # pragma: no cover
|
|
1330
1339
|
fp.write(
|
|
1331
1340
|
", Shear Force X , Shear Force Y , Shear Force Z , Total Shear Force "
|
|
1332
1341
|
)
|
|
@@ -1341,7 +1350,7 @@ class Variables:
|
|
|
1341
1350
|
fp.write(
|
|
1342
1351
|
", Press + Shear Force Radial , Press + Shear Force Theta , Press + Shear Force Axial , Total Press + Shear Force "
|
|
1343
1352
|
)
|
|
1344
|
-
if press_coeff_list:
|
|
1353
|
+
if press_coeff_list: # pragma: no cover
|
|
1345
1354
|
fp.write(
|
|
1346
1355
|
", Coeff Press X , Coeff Press Y , Coeff Press Z , Total Coeff Press "
|
|
1347
1356
|
)
|
|
@@ -1349,7 +1358,7 @@ class Variables:
|
|
|
1349
1358
|
fp.write(
|
|
1350
1359
|
", Coeff Press Radial , Coeff Press Theta , Coeff Press Axial , Total Coeff Press "
|
|
1351
1360
|
)
|
|
1352
|
-
if shear_coeff_list:
|
|
1361
|
+
if shear_coeff_list: # pragma: no cover
|
|
1353
1362
|
fp.write(
|
|
1354
1363
|
", Coeff Shear X , Coeff Shear Y , Coeff Shear Z , Total Coeff Shear ,"
|
|
1355
1364
|
)
|
|
@@ -1364,20 +1373,20 @@ class Variables:
|
|
|
1364
1373
|
fp.write(
|
|
1365
1374
|
", Coeff Press + Shear Radial , Coeff Press + Shear Theta , Coeff Press + Shear Axial , Total Coeff Press + Shear"
|
|
1366
1375
|
)
|
|
1367
|
-
if press_LDS_force_list:
|
|
1376
|
+
if press_LDS_force_list: # pragma: no cover
|
|
1368
1377
|
fp.write(", Lift Force , Drag Force , Side Force , Total Pressure Force ")
|
|
1369
|
-
if shear_LDS_force_list:
|
|
1378
|
+
if shear_LDS_force_list: # pragma: no cover
|
|
1370
1379
|
fp.write(
|
|
1371
1380
|
", Shear Force L , Shear Force D , Shear Force Side , Total Shear Force LDS "
|
|
1372
1381
|
)
|
|
1373
1382
|
fp.write(
|
|
1374
1383
|
", Press + Shear Force L , Press + Shear Force D , Press + Shear Force Side , Total Press + Shear Force LDS "
|
|
1375
1384
|
)
|
|
1376
|
-
if press_LDS_coeff_list:
|
|
1385
|
+
if press_LDS_coeff_list: # pragma: no cover
|
|
1377
1386
|
fp.write(
|
|
1378
1387
|
", Lift Coeff Press , Drag Coeff Press , Side Coeff Press , Total Coeff Press "
|
|
1379
1388
|
)
|
|
1380
|
-
if shear_LDS_coeff_list:
|
|
1389
|
+
if shear_LDS_coeff_list: # pragma: no cover
|
|
1381
1390
|
fp.write(
|
|
1382
1391
|
", Lift Coeff Shear , Drag Coeff Shear , Side Coeff Shear , Coeff Shear LDS Total,"
|
|
1383
1392
|
)
|
|
@@ -1413,7 +1422,7 @@ class Variables:
|
|
|
1413
1422
|
#
|
|
1414
1423
|
# shear force components then magnitude
|
|
1415
1424
|
#
|
|
1416
|
-
if shear_force_list:
|
|
1425
|
+
if shear_force_list: # pragma: no cover
|
|
1417
1426
|
fp.write(" , ")
|
|
1418
1427
|
for jj in range(3):
|
|
1419
1428
|
fp.write(str(shear_force_list[ii][jj]))
|
|
@@ -1445,7 +1454,7 @@ class Variables:
|
|
|
1445
1454
|
#
|
|
1446
1455
|
# Coefficient of pressure force components then magnitude
|
|
1447
1456
|
#
|
|
1448
|
-
if press_coeff_list:
|
|
1457
|
+
if press_coeff_list: # pragma: no cover
|
|
1449
1458
|
fp.write(" , ")
|
|
1450
1459
|
for jj in range(3):
|
|
1451
1460
|
fp.write(str(press_coeff_list[ii][jj]))
|
|
@@ -1460,8 +1469,12 @@ class Variables:
|
|
|
1460
1469
|
#
|
|
1461
1470
|
# Coefficient shear force components then magnitude
|
|
1462
1471
|
#
|
|
1463
|
-
if
|
|
1464
|
-
|
|
1472
|
+
if (
|
|
1473
|
+
shear_coeff_list is not None and press_coeff_list is not None
|
|
1474
|
+
): # pragma: no cover
|
|
1475
|
+
if (
|
|
1476
|
+
len(shear_coeff_list) > 0 and len(press_coeff_list) > 0
|
|
1477
|
+
): # pragma: no cover
|
|
1465
1478
|
fp.write(" , ")
|
|
1466
1479
|
for jj in range(3):
|
|
1467
1480
|
fp.write(str(shear_coeff_list[ii][jj]))
|
|
@@ -1498,15 +1511,19 @@ class Variables:
|
|
|
1498
1511
|
# No cylindrical stuff here
|
|
1499
1512
|
# LDS pressure force components then magnitude
|
|
1500
1513
|
#
|
|
1501
|
-
if press_LDS_force_list:
|
|
1514
|
+
if press_LDS_force_list: # pragma: no cover
|
|
1502
1515
|
for jj in range(3):
|
|
1503
1516
|
fp.write(str(press_LDS_force_list[ii][jj]))
|
|
1504
1517
|
fp.write(" , ")
|
|
1505
1518
|
fp.write(str(vec_mag(press_LDS_force_list[ii][:3])))
|
|
1506
1519
|
fp.write(" , ")
|
|
1507
1520
|
# LDS shear force components then magnitude
|
|
1508
|
-
if
|
|
1509
|
-
|
|
1521
|
+
if (
|
|
1522
|
+
shear_LDS_force_list is not None and press_LDS_force_list is not None
|
|
1523
|
+
): # pragma: no cover
|
|
1524
|
+
if (
|
|
1525
|
+
len(shear_LDS_force_list) > 0 and len(press_LDS_force_list) > 0
|
|
1526
|
+
): # pragma: no cover
|
|
1510
1527
|
for jj in range(3):
|
|
1511
1528
|
fp.write(str(shear_LDS_force_list[ii][jj]))
|
|
1512
1529
|
fp.write(" , ")
|
|
@@ -1522,18 +1539,20 @@ class Variables:
|
|
|
1522
1539
|
fp.write(str(vec_mag(temp_list)))
|
|
1523
1540
|
fp.write(" , ")
|
|
1524
1541
|
# LDS Coefficient of pressure force components then magnitude
|
|
1525
|
-
if press_LDS_coeff_list:
|
|
1542
|
+
if press_LDS_coeff_list: # pragma: no cover
|
|
1526
1543
|
for jj in range(3):
|
|
1527
1544
|
fp.write(str(press_LDS_coeff_list[ii][jj]))
|
|
1528
1545
|
fp.write(" , ")
|
|
1529
1546
|
fp.write(str(vec_mag(press_LDS_coeff_list[ii][:3])))
|
|
1530
1547
|
fp.write(" , ")
|
|
1531
1548
|
# LDS Coefficient shear force components then magnitude
|
|
1532
|
-
if (
|
|
1549
|
+
if ( # pragma: no cover
|
|
1533
1550
|
shear_LDS_coeff_list is not None
|
|
1534
1551
|
and press_LDS_coeff_list is not None
|
|
1535
1552
|
):
|
|
1536
|
-
if
|
|
1553
|
+
if (
|
|
1554
|
+
len(shear_LDS_coeff_list) > 0 and len(press_LDS_coeff_list) > 0
|
|
1555
|
+
): # pragma: no cover
|
|
1537
1556
|
for jj in range(3):
|
|
1538
1557
|
fp.write(str(shear_LDS_coeff_list[ii][jj]))
|
|
1539
1558
|
fp.write(" , ")
|
|
@@ -1555,7 +1574,7 @@ class Variables:
|
|
|
1555
1574
|
except IOError: # pragma: no cover
|
|
1556
1575
|
raise RuntimeError( # pragma: no cover
|
|
1557
1576
|
"Error Failed to open output csv filename for writing '" + filename + "'"
|
|
1558
|
-
)
|
|
1577
|
+
)
|
|
1559
1578
|
raise RuntimeError("Error no pressure force list to write out") # pragma: no cover
|
|
1560
1579
|
|
|
1561
1580
|
@staticmethod
|
|
@@ -1583,15 +1602,15 @@ class Variables:
|
|
|
1583
1602
|
"""
|
|
1584
1603
|
coeffs = []
|
|
1585
1604
|
qS = area_ref * vel_ref * vel_ref * dens_ref / 2.0
|
|
1586
|
-
if qS > 0:
|
|
1605
|
+
if qS > 0: # pragma: no cover
|
|
1587
1606
|
for ff in Forces:
|
|
1588
1607
|
coeffs.append(ff / qS)
|
|
1589
1608
|
else:
|
|
1590
|
-
coeffs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
|
1609
|
+
coeffs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # pragma: no cover
|
|
1591
1610
|
return coeffs
|
|
1592
1611
|
|
|
1593
1612
|
@staticmethod
|
|
1594
|
-
def _get_up_vec(up_str: str) -> np.array:
|
|
1613
|
+
def _get_up_vec(up_str: str) -> np.array: # pragma: no cover
|
|
1595
1614
|
"""
|
|
1596
1615
|
Convert the up_vector string to the actual components
|
|
1597
1616
|
|
|
@@ -1753,14 +1772,14 @@ class Variables:
|
|
|
1753
1772
|
"""
|
|
1754
1773
|
if not frame_index:
|
|
1755
1774
|
frame_index = 0
|
|
1756
|
-
if not shear_var_type:
|
|
1775
|
+
if not shear_var_type: # pragma: no cover
|
|
1757
1776
|
shear_var_type = self.SHEAR_VAR_TYPE_STRESS
|
|
1758
1777
|
shear_map = {
|
|
1759
1778
|
self.SHEAR_VAR_TYPE_STRESS: "Shear stress",
|
|
1760
1779
|
self.SHEAR_VAR_TYPE_FORCE: "Shear force",
|
|
1761
1780
|
}
|
|
1762
|
-
if not up_vector:
|
|
1763
|
-
up_vector = self.UP_VECTOR_PLUS_Z
|
|
1781
|
+
if not up_vector: # pragma: no cover
|
|
1782
|
+
up_vector = self.UP_VECTOR_PLUS_Z # pragma: no cover
|
|
1764
1783
|
_pobj_list = self.ensight.utils.parts.select_parts(pobj_list)
|
|
1765
1784
|
computed_press_forces: List[List[float]] = []
|
|
1766
1785
|
computed_shear_forces: List[List[float]] = []
|
|
@@ -1770,15 +1789,15 @@ class Variables:
|
|
|
1770
1789
|
computed_shear_forces_lds: List[List[float]] = []
|
|
1771
1790
|
computed_press_forces_lds_coeffs: List[List[float]] = []
|
|
1772
1791
|
computed_shear_forces_lds_coeffs: List[List[float]] = []
|
|
1773
|
-
if press_var_obj:
|
|
1792
|
+
if press_var_obj: # pragma: no cover
|
|
1774
1793
|
success = self._press_force_xyz_rtz(
|
|
1775
1794
|
pobj_list=pobj_list, press_var_obj=press_var_obj, frame_index=frame_index
|
|
1776
1795
|
)
|
|
1777
|
-
if not success:
|
|
1778
|
-
return None
|
|
1796
|
+
if not success: # pragma: no cover
|
|
1797
|
+
return None # pragma: no cover
|
|
1779
1798
|
temp = self._sum_pressure_forces_xyz_rtz(pobj_list=pobj_list, frame_index=frame_index)
|
|
1780
|
-
if not temp:
|
|
1781
|
-
return None
|
|
1799
|
+
if not temp: # pragma: no cover
|
|
1800
|
+
return None # pragma: no cover
|
|
1782
1801
|
computed_press_forces = temp.copy()
|
|
1783
1802
|
if shear_var_obj:
|
|
1784
1803
|
success = self._shear_force_xyz_rtz(
|
|
@@ -1800,7 +1819,7 @@ class Variables:
|
|
|
1800
1819
|
]
|
|
1801
1820
|
)
|
|
1802
1821
|
# Just making mypy happy
|
|
1803
|
-
if (
|
|
1822
|
+
if ( # pragma: no cover
|
|
1804
1823
|
coeffs_computation
|
|
1805
1824
|
and velocity_x_ref is not None
|
|
1806
1825
|
and velocity_y_ref is not None
|
|
@@ -1810,12 +1829,12 @@ class Variables:
|
|
|
1810
1829
|
):
|
|
1811
1830
|
_vec_mag = vec_mag([velocity_x_ref, velocity_y_ref, velocity_z_ref])
|
|
1812
1831
|
# We need to compute the force coeffs
|
|
1813
|
-
if computed_press_forces:
|
|
1832
|
+
if computed_press_forces: # pragma: no cover
|
|
1814
1833
|
for part_force in computed_press_forces:
|
|
1815
1834
|
computed_press_force_coeffs.append(
|
|
1816
1835
|
self._force_coeffs(part_force, area_ref, _vec_mag, density_ref)
|
|
1817
1836
|
)
|
|
1818
|
-
if computed_shear_forces:
|
|
1837
|
+
if computed_shear_forces: # pragma: no cover
|
|
1819
1838
|
for part_force in computed_shear_forces:
|
|
1820
1839
|
computed_shear_force_coeffs.append(
|
|
1821
1840
|
self._force_coeffs(part_force, area_ref, _vec_mag, density_ref)
|
|
@@ -1823,7 +1842,7 @@ class Variables:
|
|
|
1823
1842
|
lds = all(
|
|
1824
1843
|
[x is not None for x in [up_vector, velocity_x_ref, velocity_y_ref, velocity_z_ref]]
|
|
1825
1844
|
)
|
|
1826
|
-
if lds:
|
|
1845
|
+
if lds: # pragma: no cover
|
|
1827
1846
|
temp_np_vec = np.array([velocity_x_ref, velocity_y_ref, velocity_z_ref])
|
|
1828
1847
|
drag_vec = temp_np_vec / np.sqrt(np.dot(temp_np_vec, temp_np_vec))
|
|
1829
1848
|
up_vec = self._get_up_vec(up_vector)
|
|
@@ -1832,67 +1851,67 @@ class Variables:
|
|
|
1832
1851
|
# Lift vec normalized
|
|
1833
1852
|
temp_np_vec = np.cross(side_vec, drag_vec)
|
|
1834
1853
|
lift_vec = temp_np_vec / np.sqrt(np.dot(temp_np_vec, temp_np_vec))
|
|
1835
|
-
if computed_press_forces:
|
|
1854
|
+
if computed_press_forces: # pragma: no cover
|
|
1836
1855
|
for part_force in computed_press_forces:
|
|
1837
1856
|
computed_press_forces_lds.append(
|
|
1838
1857
|
self._lds_forces(np.array(part_force), lift_vec, drag_vec, side_vec)
|
|
1839
1858
|
)
|
|
1840
|
-
if computed_shear_forces:
|
|
1859
|
+
if computed_shear_forces: # pragma: no cover
|
|
1841
1860
|
for part_force in computed_shear_forces:
|
|
1842
1861
|
computed_shear_forces_lds.append(
|
|
1843
1862
|
self._lds_forces(np.array(part_force), lift_vec, drag_vec, side_vec)
|
|
1844
1863
|
)
|
|
1845
|
-
if coeffs_computation:
|
|
1846
|
-
if computed_press_force_coeffs:
|
|
1864
|
+
if coeffs_computation: # pragma: no cover
|
|
1865
|
+
if computed_press_force_coeffs: # pragma: no cover
|
|
1847
1866
|
for part_force in computed_press_force_coeffs:
|
|
1848
1867
|
computed_press_forces_lds_coeffs.append(
|
|
1849
1868
|
self._lds_forces(np.array(part_force), lift_vec, drag_vec, side_vec)
|
|
1850
1869
|
)
|
|
1851
|
-
if computed_shear_force_coeffs:
|
|
1870
|
+
if computed_shear_force_coeffs: # pragma: no cover
|
|
1852
1871
|
for part_force in computed_shear_force_coeffs:
|
|
1853
1872
|
computed_shear_forces_lds_coeffs.append(
|
|
1854
1873
|
self._lds_forces(np.array(part_force), lift_vec, drag_vec, side_vec)
|
|
1855
1874
|
)
|
|
1856
|
-
if export_filename is not None and pobj_list is not None:
|
|
1857
|
-
if len(pobj_list) > 0:
|
|
1875
|
+
if export_filename is not None and pobj_list is not None: # pragma: no cover
|
|
1876
|
+
if len(pobj_list) > 0: # pragma: no cover
|
|
1858
1877
|
press_varname = None
|
|
1859
1878
|
shear_varname = None
|
|
1860
|
-
if press_var_obj:
|
|
1879
|
+
if press_var_obj: # pragma: no cover
|
|
1861
1880
|
_press_var_id = convert_variable(self.ensight, press_var_obj)
|
|
1862
|
-
if _press_var_id:
|
|
1881
|
+
if _press_var_id: # pragma: no cover
|
|
1863
1882
|
press_varnames = [
|
|
1864
1883
|
v for v in self.ensight.objs.core.VARIABLES if v.ID == _press_var_id
|
|
1865
1884
|
]
|
|
1866
1885
|
if press_varnames:
|
|
1867
1886
|
press_varname = str(press_varnames[0].DESCRIPTION)
|
|
1868
|
-
if shear_var_obj:
|
|
1887
|
+
if shear_var_obj: # pragma: no cover
|
|
1869
1888
|
_shear_var_id = convert_variable(self.ensight, shear_var_obj)
|
|
1870
|
-
if _shear_var_id:
|
|
1889
|
+
if _shear_var_id: # pragma: no cover
|
|
1871
1890
|
shear_varnames = [
|
|
1872
1891
|
v for v in self.ensight.objs.core.VARIABLES if v.ID == _press_var_id
|
|
1873
1892
|
]
|
|
1874
|
-
if shear_varnames:
|
|
1893
|
+
if shear_varnames: # pragma: no cover
|
|
1875
1894
|
shear_varname = str(shear_varnames[0].DESCRIPTION)
|
|
1876
1895
|
params = {}
|
|
1877
|
-
if press_varname:
|
|
1896
|
+
if press_varname: # pragma: no cover
|
|
1878
1897
|
params["press_varname"] = press_varname
|
|
1879
|
-
if shear_varname:
|
|
1898
|
+
if shear_varname: # pragma: no cover
|
|
1880
1899
|
params["shear_varname"] = shear_varname
|
|
1881
|
-
if shear_var_type is not None:
|
|
1900
|
+
if shear_var_type is not None: # pragma: no cover
|
|
1882
1901
|
value = shear_map.get(shear_var_type)
|
|
1883
|
-
if value:
|
|
1902
|
+
if value: # pragma: no cover
|
|
1884
1903
|
params["shear_vartype"] = value
|
|
1885
|
-
if area_ref:
|
|
1904
|
+
if area_ref is not None: # pragma: no cover
|
|
1886
1905
|
params["Area_ref"] = str(area_ref)
|
|
1887
|
-
if density_ref:
|
|
1906
|
+
if density_ref is not None: # pragma: no cover
|
|
1888
1907
|
params["Dens_ref"] = str(density_ref)
|
|
1889
|
-
if velocity_x_ref:
|
|
1908
|
+
if velocity_x_ref is not None: # pragma: no cover
|
|
1890
1909
|
params["Vx_ref"] = str(velocity_x_ref)
|
|
1891
|
-
if velocity_y_ref:
|
|
1910
|
+
if velocity_y_ref is not None: # pragma: no cover
|
|
1892
1911
|
params["Vy_ref"] = str(velocity_y_ref)
|
|
1893
|
-
if velocity_z_ref:
|
|
1912
|
+
if velocity_z_ref is not None: # pragma: no cover
|
|
1894
1913
|
params["Vz_ref"] = str(velocity_z_ref)
|
|
1895
|
-
if up_vector:
|
|
1914
|
+
if up_vector is not None: # pragma: no cover
|
|
1896
1915
|
params["up_vector"] = up_vector
|
|
1897
1916
|
if frame_index > 0:
|
|
1898
1917
|
params["frame_index"] = str(frame_index)
|