Skip to content

Commit da5df28

Browse files
committed
Revert "Experimental - remove _result_properties"
This reverts commit d3703a8.
1 parent d3703a8 commit da5df28

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

src/ansys/dpf/core/available_result.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def name(self):
200200
"""Result operator."""
201201
if self._properties and "scripting_name" in self._properties.keys():
202202
name = self._properties["scripting_name"]
203+
elif self.operator_name in _result_properties:
204+
name = _result_properties[self.operator_name]["scripting_name"]
203205
else:
204206
name = _remove_spaces(self._physics_name)
205207
return _make_as_function_name(name)
@@ -264,8 +266,8 @@ def native_location(self):
264266
"""Native location of the result."""
265267
if hasattr(self, "_properties") and "location" in self._properties.keys():
266268
return self._properties["location"]
267-
else:
268-
return ""
269+
if self.operator_name in _result_properties:
270+
return _result_properties[self.operator_name]["location"]
269271

270272
@property
271273
def native_scoping_location(self):
@@ -305,6 +307,52 @@ def qualifier_combinations(self) -> List[dict]:
305307
return [q.__dict__() for q in self.qualifiers]
306308

307309

310+
_result_properties = {
311+
"S": {"location": "ElementalNodal", "scripting_name": "stress"},
312+
"ENF": {"location": "ElementalNodal", "scripting_name": "element_nodal_forces"},
313+
"EPEL": {"location": "ElementalNodal", "scripting_name": "elastic_strain"},
314+
"EPPL": {"location": "ElementalNodal", "scripting_name": "plastic_strain"},
315+
"ECR": {"location": "ElementalNodal", "scripting_name": "creep_strain"},
316+
"BFE": {"location": "ElementalNodal", "scripting_name": "structural_temperature"},
317+
"ETH": {"location": "ElementalNodal", "scripting_name": "thermal_strain"},
318+
"ETH_SWL": {"location": "ElementalNodal", "scripting_name": "swelling_strains"},
319+
"ENG_VOL": {"location": "Elemental", "scripting_name": "elemental_volume"},
320+
"ENG_SE": {"location": "Elemental", "scripting_name": "stiffness_matrix_energy"},
321+
"ENG_AHO": {
322+
"location": "Elemental",
323+
"scripting_name": "artificial_hourglass_energy",
324+
},
325+
"ENG_KE": {"location": "Elemental", "scripting_name": "kinetic_energy"},
326+
"ENG_CO": {"location": "Elemental", "scripting_name": "co_energy"},
327+
"ENG_INC": {"location": "Elemental", "scripting_name": "incremental_energy"},
328+
"ENG_TH": {"location": "Elemental", "scripting_name": "thermal_dissipation_energy"},
329+
"U": {"location": "Nodal", "scripting_name": "displacement"},
330+
"V": {"location": "Nodal", "scripting_name": "velocity"},
331+
"A": {"location": "Nodal", "scripting_name": "acceleration"},
332+
"RF": {"location": "Nodal", "scripting_name": "reaction_force"},
333+
"F": {"location": "Nodal", "scripting_name": "nodal_force"},
334+
"M": {"location": "Nodal", "scripting_name": "nodal_moment"},
335+
"TEMP": {"location": "Nodal", "scripting_name": "temperature"},
336+
"EF": {"location": "ElementalNodal", "scripting_name": "electric_field"},
337+
"VOLT": {"location": "Nodal", "scripting_name": "electric_potential"},
338+
"TF": {"location": "ElementalNodal", "scripting_name": "heat_flux"},
339+
"UTOT": {"location": "Nodal", "scripting_name": "raw_displacement"},
340+
"RFTOT": {"location": "Nodal", "scripting_name": "raw_reaction_force"},
341+
"ECT_STAT": {"location": "ElementalNodal", "scripting_name": "contact_status"},
342+
"ECT_PRES": {"location": "ElementalNodal", "scripting_name": "contact_pressure"},
343+
"ECT_PENE": {"location": "ElementalNodal", "scripting_name": "contact_penetration"},
344+
"ECT_SLIDE": {"location": "ElementalNodal", "scripting_name": "contact_sliding_distance"},
345+
"ECT_GAP": {"location": "ElementalNodal", "scripting_name": "contact_gap_distance"},
346+
"ECT_SFRIC": {"location": "ElementalNodal", "scripting_name": "contact_friction_stress"},
347+
"ECT_STOT": {"location": "ElementalNodal", "scripting_name": "contact_total_stress"},
348+
"ECT_FRES": {
349+
"location": "ElementalNodal",
350+
"scripting_name": "contact_fluid_penetration_pressure",
351+
},
352+
"ECT_FLUX": {"location": "ElementalNodal", "scripting_name": "contact_surface_heat_flux"},
353+
}
354+
355+
308356
def available_result_from_name(name) -> AvailableResult:
309357
"""Create an instance of AvailableResult from a specified results name.
310358

src/ansys/dpf/core/result_info.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,17 @@ def _get_result(self, numres):
472472
self._api.result_info_get_result_location(self, numres, loc_name)
473473
loc_name = str(loc_name)
474474
except AttributeError:
475-
loc_name = ""
475+
if name in available_result._result_properties:
476+
loc_name = available_result._result_properties[name]["location"]
477+
else:
478+
loc_name = ""
476479
try:
477480
scripting_name = self._api.result_info_get_result_scripting_name(self, numres)
478481
except AttributeError:
479-
scripting_name = available_result._remove_spaces(physic_name)
482+
if name in available_result._result_properties:
483+
scripting_name = available_result._result_properties[name]["scripting_name"]
484+
else:
485+
scripting_name = available_result._remove_spaces(physic_name)
480486
num_sub_res = self._api.result_info_get_number_of_sub_results(self, numres)
481487
sub_res = {}
482488
for ires in range(num_sub_res):

src/ansys/dpf/core/results.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,12 @@ def __init__(self, connector, mesh_by_default, result_info, server):
272272
self._mesh_scoping = None
273273
self._location = None
274274
self._mesh_by_default = mesh_by_default
275-
self._result_info = result_info
275+
if isinstance(result_info, str):
276+
from ansys.dpf.core.available_result import available_result_from_name
277+
278+
self._result_info = available_result_from_name(result_info)
279+
else:
280+
self._result_info = result_info
276281
self._specific_fc_type = None
277282
from ansys.dpf.core import operators
278283

0 commit comments

Comments
 (0)