diff --git a/src/ansys/dpf/core/available_result.py b/src/ansys/dpf/core/available_result.py index 6353eb7d58..491da49b6d 100644 --- a/src/ansys/dpf/core/available_result.py +++ b/src/ansys/dpf/core/available_result.py @@ -200,8 +200,6 @@ def name(self): """Result operator.""" if self._properties and "scripting_name" in self._properties.keys(): name = self._properties["scripting_name"] - elif self.operator_name in _result_properties: - name = _result_properties[self.operator_name]["scripting_name"] else: name = _remove_spaces(self._physics_name) return _make_as_function_name(name) @@ -266,8 +264,8 @@ def native_location(self): """Native location of the result.""" if hasattr(self, "_properties") and "location" in self._properties.keys(): return self._properties["location"] - if self.operator_name in _result_properties: - return _result_properties[self.operator_name]["location"] + else: + return "" @property def native_scoping_location(self): @@ -307,60 +305,6 @@ def qualifier_combinations(self) -> List[dict]: return [q.__dict__() for q in self.qualifiers] -_result_properties = { - "S": {"location": "ElementalNodal", "scripting_name": "stress"}, - "ENF": {"location": "ElementalNodal", "scripting_name": "element_nodal_forces"}, - "EPEL": {"location": "ElementalNodal", "scripting_name": "elastic_strain"}, - "EPPL": {"location": "ElementalNodal", "scripting_name": "plastic_strain"}, - "EPCR": {"location": "ElementalNodal", "scripting_name": "creep_strain"}, - "BFE": {"location": "ElementalNodal", "scripting_name": "structural_temperature"}, - "ETH": {"location": "ElementalNodal", "scripting_name": "thermal_strain"}, - "ETH_SWL": {"location": "ElementalNodal", "scripting_name": "swelling_strains"}, - "ENG_VOL": {"location": "Elemental", "scripting_name": "elemental_volume"}, - "ENG_SE": {"location": "Elemental", "scripting_name": "stiffness_matrix_energy"}, - "ENG_AHO": { - "location": "Elemental", - "scripting_name": "artificial_hourglass_energy", - }, - "ENG_KE": {"location": "Elemental", "scripting_name": "kinetic_energy"}, - "ENG_CO": {"location": "Elemental", "scripting_name": "co_energy"}, - "ENG_INC": {"location": "Elemental", "scripting_name": "incremental_energy"}, - "ENG_TH": {"location": "Elemental", "scripting_name": "thermal_dissipation_energy"}, - "U": {"location": "Nodal", "scripting_name": "displacement"}, - "V": {"location": "Nodal", "scripting_name": "velocity"}, - "A": {"location": "Nodal", "scripting_name": "acceleration"}, - "RF": {"location": "Nodal", "scripting_name": "reaction_force"}, - "F": {"location": "Nodal", "scripting_name": "nodal_force"}, - "M": {"location": "Nodal", "scripting_name": "nodal_moment"}, - "TEMP": {"location": "Nodal", "scripting_name": "temperature"}, - "EF": {"location": "ElementalNodal", "scripting_name": "electric_field"}, - "VOLT": {"location": "Nodal", "scripting_name": "electric_potential"}, - "TF": {"location": "ElementalNodal", "scripting_name": "heat_flux"}, - "UTOT": {"location": "Nodal", "scripting_name": "raw_displacement"}, - "RFTOT": {"location": "Nodal", "scripting_name": "raw_reaction_force"}, - "ECT_STAT": {"location": "ElementalNodal", "scripting_name": "contact_status"}, - "ECT_PRES": {"location": "ElementalNodal", "scripting_name": "contact_pressure"}, - "ECT_PENE": {"location": "ElementalNodal", "scripting_name": "contact_penetration"}, - "ECT_SLIDE": {"location": "ElementalNodal", "scripting_name": "contact_sliding_distance"}, - "ECT_GAP": {"location": "ElementalNodal", "scripting_name": "contact_gap_distance"}, - "ECT_SFRIC": {"location": "ElementalNodal", "scripting_name": "contact_friction_stress"}, - "ECT_STOT": {"location": "ElementalNodal", "scripting_name": "contact_total_stress"}, - "ECT_FRES": { - "location": "ElementalNodal", - "scripting_name": "contact_fluid_penetration_pressure", - }, - "ECT_FLUX": {"location": "ElementalNodal", "scripting_name": "contact_surface_heat_flux"}, - "B_N": {"location": "ElementalNodal", "scripting_name": "beam_axial_force"}, - "B_M1": {"location": "ElementalNodal", "scripting_name": "beam_s_bending_moment"}, - "B_M2": {"location": "ElementalNodal", "scripting_name": "beam_t_bending_moment"}, - "B_MT": {"location": "ElementalNodal", "scripting_name": "beam_torsional_moment"}, - "B_SN": {"location": "ElementalNodal", "scripting_name": "beam_axial_stress"}, - "B_EL": {"location": "ElementalNodal", "scripting_name": "beam_axial_total_strain"}, - "B_T1": {"location": "ElementalNodal", "scripting_name": "beam_s_shear_force"}, - "B_T2": {"location": "ElementalNodal", "scripting_name": "beam_t_shear_force"}, -} - - def available_result_from_name(name) -> AvailableResult: """Create an instance of AvailableResult from a specified results name. diff --git a/src/ansys/dpf/core/result_info.py b/src/ansys/dpf/core/result_info.py index ae36cbde7d..8d2e70cd72 100644 --- a/src/ansys/dpf/core/result_info.py +++ b/src/ansys/dpf/core/result_info.py @@ -472,17 +472,11 @@ def _get_result(self, numres): self._api.result_info_get_result_location(self, numres, loc_name) loc_name = str(loc_name) except AttributeError: - if name in available_result._result_properties: - loc_name = available_result._result_properties[name]["location"] - else: - loc_name = "" + loc_name = "" try: scripting_name = self._api.result_info_get_result_scripting_name(self, numres) except AttributeError: - if name in available_result._result_properties: - scripting_name = available_result._result_properties[name]["scripting_name"] - else: - scripting_name = available_result._remove_spaces(physic_name) + scripting_name = available_result._remove_spaces(physic_name) num_sub_res = self._api.result_info_get_number_of_sub_results(self, numres) sub_res = {} for ires in range(num_sub_res): diff --git a/src/ansys/dpf/core/results.py b/src/ansys/dpf/core/results.py index a1801ee4f5..c852d5941a 100644 --- a/src/ansys/dpf/core/results.py +++ b/src/ansys/dpf/core/results.py @@ -272,12 +272,7 @@ def __init__(self, connector, mesh_by_default, result_info, server): self._mesh_scoping = None self._location = None self._mesh_by_default = mesh_by_default - if isinstance(result_info, str): - from ansys.dpf.core.available_result import available_result_from_name - - self._result_info = available_result_from_name(result_info) - else: - self._result_info = result_info + self._result_info = result_info self._specific_fc_type = None from ansys.dpf.core import operators @@ -644,8 +639,9 @@ class CommonResults(Results): of the class:'Results'. """ - def __init__(self, connector, mesh_by_default, result_info, server): - super().__init__(connector, mesh_by_default, result_info, server, False) + def __init__(self, connector, result_info, mesh_by_default, server): + self._result_info = result_info + super().__init__(connector, result_info, mesh_by_default, server, False) self._op_map_rev = dict( displacement="displacement", stress="stress", @@ -678,7 +674,7 @@ def displacement(self): >>> disp = disp.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES") >>> last_time_disp = disp.eval() """ - return super().__result__("displacement") + return super().__result__(self._result_info["displacement"]) @property def elastic_strain(self): @@ -704,7 +700,7 @@ def elastic_strain(self): >>> strain = strain.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES") >>> last_time_disp = strain.eval() """ - return super().__result__("elastic_strain") + return super().__result__(self._result_info["elastic_strain"]) @property def stress(self): @@ -730,7 +726,7 @@ def stress(self): >>> stress = stress.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES") >>> last_time_disp = stress.eval() """ - return super().__result__("stress") + return super().__result__(self._result_info["stress"]) @property def structural_temperature(self): @@ -756,7 +752,7 @@ def structural_temperature(self): >>> structural_temperature = structural_temperature.on_last_time_freq() >>> last_time_disp = structural_temperature.eval() """ - return super().__result__("structural_temperature") + return super().__result__(self._result_info["structural_temperature"]) @property def temperature(self): @@ -781,7 +777,7 @@ def temperature(self): >>> temperature = model.results.temperature.on_last_time_freq() >>> last_time_disp = temperature.eval() """ - return super().__result__("temperature") + return super().__result__(self._result_info["temperature"]) @property def electric_potential(self): @@ -806,4 +802,4 @@ def electric_potential(self): >>> electric_potential = model.results.electric_potential.on_first_time_freq() >>> last_time_disp = electric_potential.eval() """ - return super().__result__("electric_potential") + return super().__result__(self._result_info["electric_potential"])