From eb7b0e64e6799bd15f94a76c0319d7302693d40f Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Mon, 22 Apr 2024 14:58:45 +0200 Subject: [PATCH 01/22] Add IcepakDesignSettings class --- pyaedt/icepak.py | 1224 +++++++++++++++++++++++++++++----------------- 1 file changed, 767 insertions(+), 457 deletions(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 843f0da26b8..0029cbe9921 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -12,6 +12,7 @@ from pyaedt.generic.general_methods import GrpcApiError from pyaedt.modeler.cad.elements3d import FacePrimitive from pyaedt.modeler.geometry_operators import GeometryOperators as go +import pyaedt.modules.Material from pyaedt.modules.SetupTemplates import SetupKeys if is_linux and is_ironpython: @@ -23,6 +24,7 @@ from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.generic.DataHandlers import _arg2dict +from pyaedt.generic.DataHandlers import _dict2arg from pyaedt.generic.DataHandlers import random_string from pyaedt.generic.configurations import ConfigurationsIcepak from pyaedt.generic.general_methods import generate_unique_name @@ -174,10 +176,15 @@ def __init__( ) self._monitor = Monitor(self) self._configurations = ConfigurationsIcepak(self) + self._design_settins = IcepakDesignSettings(self) def _init_from_design(self, *args, **kwargs): self.__init__(*args, **kwargs) + @property + def design_settings(self): + return self._design_settins + @property def problem_type(self): """Problem type of the Icepak design. Options are ``"TemperatureAndFlow"``, ``"TemperatureOnly"``, @@ -1605,25 +1612,27 @@ def create_parametric_heatsink_on_face( hs.name = hs_name return hs, name_map - # fmt: off - @pyaedt_function_handler() + @pyaedt_function_handler( + ambtemp="ambient_temperature", + performvalidation="perform_validation", + defaultfluid="default_fluid", + defaultsolid="default_solid", + ) def edit_design_settings( - self, - gravity_dir=0, - ambtemp=20, - performvalidation=False, - check_level="None", - defaultfluid="air", - defaultsolid="Al-Extruded", - export_monitor=False, - export_directory=os.getcwd(), - gauge_pressure=0, - radiation_temperature=20, - ignore_unclassified_objects=False, - skip_intersection_checks=False, - **kwargs + self, + gravity_dir=0, + ambient_temperature=20, + perform_validation=False, + check_level="None", + default_fluid="air", + default_solid="Al-Extruded", + export_monitor=False, + export_directory=os.getcwd(), + gauge_pressure=0, + radiation_temperature=20, + ignore_unclassified_objects=False, + skip_intersection_checks=False, ): - # fmt: on """Update the main settings of the design. Parameters @@ -1631,17 +1640,20 @@ def edit_design_settings( gravity_dir : int, optional Gravity direction from -X to +Z. Options are ``0`` to ``5``. The default is ``0``. - ambtemp : float, str, optional + ambient_temperature : float, str or BoundaryDictionary, optional Ambient temperature. The default is ``20``. - The default unit is celsius for float or string including unit definition is accepted, e.g. ``325kel``. - performvalidation : bool, optional + The default unit is Celsius for ``float`` or ``str`` including unit + definition is accepted, e.g. ``325kel``. + :class:`pyaedt.modules.Boundary.BoundaryDictionary` objects can be used + for transient assignments. + perform_validation : bool, optional Whether to perform validation. The default is ``False``. check_level : str, optional Level of check to perform during validation. The default is ``"None"``. - defaultfluid : str, optional + default_fluid : str, optional Default fluid material. The default is ``"air"``. - defaultsolid : str, optional + default_solid : str, optional Default solid material. The default is ``"Al-Extruded"``. export_monitor : bool, optional Whether to use the default export directory for monitor point data. @@ -1670,82 +1682,33 @@ def edit_design_settings( >>> oDesign.SetDesignSettings """ - # - # Configure design settings for gravity etc - IceGravity = ["X", "Y", "Z"] - GVPos = False - if "gravityDir" in kwargs: # pragma: no cover - warnings.warn( - "`gravityDir` is deprecated. Use `gravity_dir` instead.", - DeprecationWarning, - ) - - gravity_dir = kwargs["gravityDir"] - if "CheckLevel" in kwargs: # pragma: no cover - warnings.warn( - "`CheckLevel` is deprecated. Use `check_level` instead.", - DeprecationWarning, - ) - - check_level = kwargs["CheckLevel"] - if int(gravity_dir) > 2: - GVPos = True - GVA = IceGravity[int(gravity_dir) - 3] - self._odesign.SetDesignSettings( - [ - "NAME:Design Settings Data", - "Perform Minimal validation:=", - performvalidation, - "Default Fluid Material:=", - defaultfluid, - "Default Solid Material:=", - defaultsolid, - "Default Surface Material:=", - "Steel-oxidised-surface", - "AmbientTemperature:=", - self.value_with_units(ambtemp, "cel"), - "AmbientPressure:=", - self.value_with_units(gauge_pressure, "n_per_meter_sq"), - "AmbientRadiationTemperature:=", - self.value_with_units(radiation_temperature, "cel"), - "Gravity Vector CS ID:=", - 1, - "Gravity Vector Axis:=", - GVA, - "Positive:=", - GVPos, - "ExportOnSimulationComplete:=", - export_monitor, - "ExportDirectory:=", - export_directory, - ], - [ - "NAME:Model Validation Settings", - "EntityCheckLevel:=", - check_level, - "IgnoreUnclassifiedObjects:=", - ignore_unclassified_objects, - "SkipIntersectionChecks:=", - skip_intersection_checks, - ], - ) - return True - - @pyaedt_function_handler(designname="design", - setupname="setup", - sweepname="sweep", - paramlist="parameters", - object_list="assignment") + self.design_settings.ambient_temperature = ambient_temperature + self.design_settings.gravity_direction = gravity_dir + self.design_settings.default_fluid_material = default_fluid + self.design_settings.default_solid_material = default_solid + self.design_settings.perform_validation = perform_validation + self.design_settings.check_level = check_level + self.design_settings.export_monitor = export_monitor + self.design_settings.export_directory = export_directory + self.design_settings.gauge_pressure = gauge_pressure + self.design_settings.radiation_temperature = radiation_temperature + self.design_settings.ignore_unclassified_objects = ignore_unclassified_objects + self.design_settings.skip_intersection_checks = skip_intersection_checks + return self.design_settings.update() + + @pyaedt_function_handler( + designname="design", setupname="setup", sweepname="sweep", paramlist="parameters", object_list="assignment" + ) def assign_em_losses( - self, - design="HFSSDesign1", - setup="Setup1", - sweep="LastAdaptive", - map_frequency=None, - surface_objects=None, - source_project_name=None, - parameters=None, - assignment=None, + self, + design="HFSSDesign1", + setup="Setup1", + sweep="LastAdaptive", + map_frequency=None, + surface_objects=None, + source_project_name=None, + parameters=None, + assignment=None, ): """Map EM losses to an Icepak design. @@ -1850,13 +1813,13 @@ def assign_em_losses( @pyaedt_function_handler() def eval_surface_quantity_from_field_summary( - self, - faces_list, - quantity_name="HeatTransCoeff", - savedir=None, - filename=None, - sweep_name=None, - parameter_dict_with_values={}, + self, + faces_list, + quantity_name="HeatTransCoeff", + savedir=None, + filename=None, + sweep_name=None, + parameter_dict_with_values={}, ): """Export the field surface output. @@ -1923,13 +1886,13 @@ def eval_surface_quantity_from_field_summary( return filename def eval_volume_quantity_from_field_summary( - self, - object_list, - quantity_name="HeatTransCoeff", - savedir=None, - filename=None, - sweep_name=None, - parameter_dict_with_values={}, + self, + object_list, + quantity_name="HeatTransCoeff", + savedir=None, + filename=None, + sweep_name=None, + parameter_dict_with_values={}, ): """Export the field volume output. @@ -1994,16 +1957,16 @@ def eval_volume_quantity_from_field_summary( return filename def export_summary( - self, - output_dir=None, - solution_name=None, - type="Object", - geometry_type="Volume", - quantity="Temperature", - variation="", - variation_list=None, - filename="IPKsummaryReport", - **kwargs + self, + output_dir=None, + solution_name=None, + type="Object", + geometry_type="Volume", + quantity="Temperature", + variation="", + variation_list=None, + filename="IPKsummaryReport", + **kwargs, ): """Export a fields summary of all objects. @@ -2040,16 +2003,16 @@ def export_summary( >>> oModule.EditFieldsSummarySetting >>> oModule.ExportFieldsSummary """ - if 'geometryType' in kwargs: - warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", - DeprecationWarning) + if "geometryType" in kwargs: + warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", DeprecationWarning) - if 'variationlist' in kwargs: - warnings.warn("The 'variationlist' argument is deprecated. Use 'variation_list' instead.", - DeprecationWarning) + if "variationlist" in kwargs: + warnings.warn( + "The 'variationlist' argument is deprecated. Use 'variation_list' instead.", DeprecationWarning + ) - geometry_type = kwargs.get('geometryType', geometry_type) - variation_list = kwargs.get('variationlist', variation_list) + geometry_type = kwargs.get("geometryType", geometry_type) + variation_list = kwargs.get("variationlist", variation_list) if variation_list is None: variation_list = [] @@ -2201,14 +2164,14 @@ def get_link_data(self, links_data, **kwargs): @pyaedt_function_handler() def create_fan( - self, - name=None, - is_2d=False, - shape="Circular", - cross_section="XY", - radius="0.008mm", - hub_radius="0mm", - origin=None, + self, + name=None, + is_2d=False, + shape="Circular", + cross_section="XY", + radius="0.008mm", + hub_radius="0mm", + origin=None, ): """Create a fan component in Icepak that is linked to an HFSS 3D Layout object. @@ -2302,7 +2265,7 @@ def create_fan( "MaterialDefinitionParameters": OrderedDict({"VariableOrders": OrderedDict()}), "MapInstanceParameters": "DesignVariable", "UniqueDefinitionIdentifier": "57c8ab4e-4db9-4881-b6bb-" - + random_string(12, char_set="abcdef0123456789"), + + random_string(12, char_set="abcdef0123456789"), "OriginFilePath": "", "IsLocal": False, "ChecksumString": "", @@ -2336,7 +2299,7 @@ def create_fan( @pyaedt_function_handler() def create_ipk_3dcomponent_pcb( - self, + self, compName, setupLinkInfo, solutionFreq, @@ -2490,7 +2453,7 @@ def create_ipk_3dcomponent_pcb( @pyaedt_function_handler() def create_pcb_from_3dlayout( - self, + self, component_name, project_name, design_name, @@ -2660,15 +2623,15 @@ def copyGroupFrom(self, group_name, source_design, source_project_name=None, sou @pyaedt_function_handler() def globalMeshSettings( - self, - meshtype, - gap_min_elements="1", - noOgrids=False, - MLM_en=True, - MLM_Type="3D", - stairStep_en=False, - edge_min_elements="1", - object="Region", + self, + meshtype, + gap_min_elements="1", + noOgrids=False, + MLM_en=True, + MLM_Type="3D", + stairStep_en=False, + edge_min_elements="1", + object="Region", ): """Create a custom mesh tailored on a PCB design. @@ -2757,7 +2720,7 @@ def globalMeshSettings( @pyaedt_function_handler() def create_meshregion_component( - self, scale_factor=1.0, name="Component_Region", restore_padding_values=[50, 50, 50, 50, 50, 50] + self, scale_factor=1.0, name="Component_Region", restore_padding_values=[50, 50, 50, 50, 50, 50] ): """Create a bounding box to use as a mesh region in Icepak. @@ -2904,14 +2867,14 @@ def get_gas_objects(self): @pyaedt_function_handler() def generate_fluent_mesh( - self, - object_lists=None, - meshtype="tetrahedral", - min_size=None, - max_size=None, - inflation_layer_number=3, - inflation_growth_rate=1.2, - mesh_growth_rate=1.2, + self, + object_lists=None, + meshtype="tetrahedral", + min_size=None, + max_size=None, + inflation_layer_number=3, + inflation_growth_rate=1.2, + mesh_growth_rate=1.2, ): """Generate a Fluent mesh for a list of selected objects and assign the mesh automatically to the objects. @@ -3070,13 +3033,13 @@ def generate_fluent_mesh( @pyaedt_function_handler() def apply_icepak_settings( - self, - ambienttemp=20, - gravityDir=5, - perform_minimal_val=True, - default_fluid="air", - default_solid="Al-Extruded", - default_surface="Steel-oxidised-surface", + self, + ambienttemp=20, + gravityDir=5, + perform_minimal_val=True, + default_fluid="air", + default_solid="Al-Extruded", + default_surface="Steel-oxidised-surface", ): """Apply Icepak default design settings. @@ -3204,31 +3167,31 @@ def assign_surface_material(self, obj, mat): @pyaedt_function_handler() def import_idf( - self, - board_path, - library_path=None, - control_path=None, - filter_cap=False, - filter_ind=False, - filter_res=False, - filter_height_under=None, - filter_height_exclude_2d=False, - power_under=None, - create_filtered_as_non_model=False, - high_surface_thick="0.07mm", - low_surface_thick="0.07mm", - internal_thick="0.07mm", - internal_layer_number=2, - high_surface_coverage=30, - low_surface_coverage=30, - internal_layer_coverage=30, - trace_material="Cu-Pure", - substrate_material="FR-4", - create_board=True, - model_board_as_rect=False, - model_device_as_rect=True, - cutoff_height="5mm", - component_lib="", + self, + board_path, + library_path=None, + control_path=None, + filter_cap=False, + filter_ind=False, + filter_res=False, + filter_height_under=None, + filter_height_exclude_2d=False, + power_under=None, + create_filtered_as_non_model=False, + high_surface_thick="0.07mm", + low_surface_thick="0.07mm", + internal_thick="0.07mm", + internal_layer_number=2, + high_surface_coverage=30, + low_surface_coverage=30, + internal_layer_coverage=30, + trace_material="Cu-Pure", + substrate_material="FR-4", + create_board=True, + model_board_as_rect=False, + model_device_as_rect=True, + cutoff_height="5mm", + component_lib="", ): """Import an IDF file into an Icepak design. @@ -3508,33 +3471,33 @@ def get_face_normal(obj_face): @pyaedt_function_handler() def assign_stationary_wall( - self, - geometry, - boundary_condition, - name=None, - temperature="0cel", - heat_flux="0irrad_W_per_m2", - thickness="0mm", - htc="0w_per_m2kel", - ref_temperature="AmbientTemp", - material="Al-Extruded", # relevant if th>0 - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", # relevant if radiate = False - ht_correlation=False, - ht_correlation_type="Natural Convection", - ht_correlation_fluid="air", - ht_correlation_flow_type="Turbulent", - ht_correlation_flow_direction="X", - ht_correlation_value_type="Average Values", # "Local Values" - ht_correlation_free_stream_velocity="1m_per_sec", - ht_correlation_surface="Vertical", # Top, Bottom, Vertical - ht_correlation_amb_temperature="AmbientTemp", - shell_conduction=False, - ext_surf_rad=False, - ext_surf_rad_material="Stainless-steel-cleaned", - ext_surf_rad_ref_temp="AmbientTemp", - ext_surf_rad_view_factor="1", - **kwargs + self, + geometry, + boundary_condition, + name=None, + temperature="0cel", + heat_flux="0irrad_W_per_m2", + thickness="0mm", + htc="0w_per_m2kel", + ref_temperature="AmbientTemp", + material="Al-Extruded", # relevant if th>0 + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", # relevant if radiate = False + ht_correlation=False, + ht_correlation_type="Natural Convection", + ht_correlation_fluid="air", + ht_correlation_flow_type="Turbulent", + ht_correlation_flow_direction="X", + ht_correlation_value_type="Average Values", # "Local Values" + ht_correlation_free_stream_velocity="1m_per_sec", + ht_correlation_surface="Vertical", # Top, Bottom, Vertical + ht_correlation_amb_temperature="AmbientTemp", + shell_conduction=False, + ext_surf_rad=False, + ext_surf_rad_material="Stainless-steel-cleaned", + ext_surf_rad_ref_temp="AmbientTemp", + ext_surf_rad_view_factor="1", + **kwargs, ): """Assign surface wall boundary condition. @@ -3684,18 +3647,22 @@ def assign_stationary_wall( props["Solid Material"] = material props["External Condition"] = boundary_condition if "htc_dataset" in kwargs: # backward compatibility - warnings.warn("``htc_dataset`` argument is being deprecated. Create a dictionary as per" - "documentation and assign it to the ``htc`` argument.", DeprecationWarning) + warnings.warn( + "``htc_dataset`` argument is being deprecated. Create a dictionary as per" + "documentation and assign it to the ``htc`` argument.", + DeprecationWarning, + ) if kwargs["htc_dataset"] is not None: - htc = {"Type": "Temp Dep", - "Function": "Piecewise Linear", - "Values": kwargs["htc_dataset"], - } + htc = { + "Type": "Temp Dep", + "Function": "Piecewise Linear", + "Values": kwargs["htc_dataset"], + } for quantity, assignment_value, to_add in [ ("External Radiation Reference Temperature", ext_surf_rad_ref_temp, ext_surf_rad), ("Heat Transfer Coefficient", htc, boundary_condition == "Heat Transfer Coefficient"), ("Temperature", temperature, boundary_condition == "Temperature"), - ("Heat Flux", heat_flux, boundary_condition == "Heat Flux") + ("Heat Flux", heat_flux, boundary_condition == "Heat Flux"), ]: if to_add: if isinstance(assignment_value, (dict, BoundaryDictionary)): @@ -3748,15 +3715,15 @@ def assign_stationary_wall( @pyaedt_function_handler() def assign_stationary_wall_with_heat_flux( - self, - geometry, - name=None, - heat_flux="0irrad_W_per_m2", - thickness="0mm", - material="Al-Extruded", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, + self, + geometry, + name=None, + heat_flux="0irrad_W_per_m2", + thickness="0mm", + material="Al-Extruded", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, ): """Assign a surface wall boundary condition with specified heat flux. @@ -3810,15 +3777,15 @@ def assign_stationary_wall_with_heat_flux( @pyaedt_function_handler() def assign_stationary_wall_with_temperature( - self, - geometry, - name=None, - temperature="0cel", - thickness="0mm", - material="Al-Extruded", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, + self, + geometry, + name=None, + temperature="0cel", + thickness="0mm", + material="Al-Extruded", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, ): """Assign a surface wall boundary condition with specified temperature. @@ -3873,30 +3840,30 @@ def assign_stationary_wall_with_temperature( @pyaedt_function_handler() def assign_stationary_wall_with_htc( - self, - geometry, - name=None, - thickness="0mm", - material="Al-Extruded", - htc="0w_per_m2kel", - ref_temperature="AmbientTemp", - ht_correlation=False, - ht_correlation_type="Natural Convection", - ht_correlation_fluid="air", - ht_correlation_flow_type="Turbulent", - ht_correlation_flow_direction="X", - ht_correlation_value_type="Average Values", - ht_correlation_free_stream_velocity="1m_per_sec", - ht_correlation_surface="Vertical", - ht_correlation_amb_temperature="AmbientTemp", - ext_surf_rad=False, - ext_surf_rad_material="Stainless-steel-cleaned", - ext_surf_rad_ref_temp="AmbientTemp", - ext_surf_rad_view_factor="1", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, - **kwargs + self, + geometry, + name=None, + thickness="0mm", + material="Al-Extruded", + htc="0w_per_m2kel", + ref_temperature="AmbientTemp", + ht_correlation=False, + ht_correlation_type="Natural Convection", + ht_correlation_fluid="air", + ht_correlation_flow_type="Turbulent", + ht_correlation_flow_direction="X", + ht_correlation_value_type="Average Values", + ht_correlation_free_stream_velocity="1m_per_sec", + ht_correlation_surface="Vertical", + ht_correlation_amb_temperature="AmbientTemp", + ext_surf_rad=False, + ext_surf_rad_material="Stainless-steel-cleaned", + ext_surf_rad_ref_temp="AmbientTemp", + ext_surf_rad_view_factor="1", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, + **kwargs, ): """Assign a surface wall boundary condition with specified heat transfer coefficient. @@ -4129,14 +4096,14 @@ def _parse_variation_data(self, quantity, variation_type, variation_value, funct @pyaedt_function_handler() def assign_source( - self, - assignment, - thermal_condition, - assignment_value, - boundary_name=None, - radiate=False, - voltage_current_choice=False, - voltage_current_value=None, + self, + assignment, + thermal_condition, + assignment_value, + boundary_name=None, + radiate=False, + voltage_current_choice=False, + voltage_current_value=None, ): """Create a source power for a face. @@ -4361,7 +4328,7 @@ def create_resistor_network_from_matrix(self, sources_power, faces_ids, matrix, @pyaedt_function_handler def assign_solid_block( - self, object_name, power_assignment, boundary_name=None, htc=None, ext_temperature="AmbientTemp" + self, object_name, power_assignment, boundary_name=None, htc=None, ext_temperature="AmbientTemp" ): """ Assign block boundary for solid objects. @@ -4478,7 +4445,7 @@ def assign_solid_block( @pyaedt_function_handler def assign_hollow_block( - self, object_name, assignment_type, assignment_value, boundary_name=None, external_temperature="AmbientTemp" + self, object_name, assignment_type, assignment_value, boundary_name=None, external_temperature="AmbientTemp" ): """Assign block boundary for hollow objects. @@ -4643,18 +4610,18 @@ def get_fans_operating_point(self, export_file=None, setup_name=None, time_step= @pyaedt_function_handler() def assign_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - flow_type="Pressure", - pressure="AmbientPressure", - no_reverse_flow=False, - velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], - mass_flow_rate="0kg_per_s", - inflow=True, - direction_vector=None, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + flow_type="Pressure", + pressure="AmbientPressure", + no_reverse_flow=False, + velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], + mass_flow_rate="0kg_per_s", + inflow=True, + direction_vector=None, ): """ Assign free opening boundary condition. @@ -4735,8 +4702,9 @@ def assign_free_opening( mass_flow_rate = str(mass_flow_rate) + "kg_per_s" if not isinstance(temperature, str) and not isinstance(temperature, (dict, BoundaryDictionary)): temperature = str(temperature) + "cel" - if not isinstance(radiation_temperature, str) and not isinstance(radiation_temperature, (dict, - BoundaryDictionary)): + if not isinstance(radiation_temperature, str) and not isinstance( + radiation_temperature, (dict, BoundaryDictionary) + ): radiation_temperature = str(radiation_temperature) + "cel" if not isinstance(pressure, str) and not isinstance(pressure, (dict, BoundaryDictionary)): pressure = str(pressure) + "pascal" @@ -4808,13 +4776,13 @@ def assign_free_opening( @pyaedt_function_handler() def assign_pressure_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - no_reverse_flow=False, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + no_reverse_flow=False, ): """ Assign free opening boundary condition. @@ -4876,13 +4844,13 @@ def assign_pressure_free_opening( @pyaedt_function_handler() def assign_velocity_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], ): """ Assign free opening boundary condition. @@ -4949,15 +4917,15 @@ def assign_velocity_free_opening( @pyaedt_function_handler() def assign_mass_flow_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - mass_flow_rate="0kg_per_s", - inflow=True, - direction_vector=None, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + mass_flow_rate="0kg_per_s", + inflow=True, + direction_vector=None, ): """ Assign free opening boundary condition. @@ -5145,13 +5113,26 @@ def assign_adiabatic_plate(self, assignment, high_radiation_dict=None, low_radia return None @pyaedt_function_handler() - def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - loss_type="Device", linear_loss = ["1m_per_sec", "1m_per_sec", "1m_per_sec"], - quadratic_loss = [1, 1, 1], linear_loss_free_area_ratio = [1, 1, 1], - quadratic_loss_free_area_ratio = [1, 1, 1], power_law_constant=1, power_law_exponent=1, - loss_curves_x = [[0, 1], [0, 1]], loss_curves_y = [[0, 1], [0, 1]], - loss_curves_z = [[0, 1], [0, 1]], loss_curve_flow_unit = "m_per_sec", - loss_curve_pressure_unit = "n_per_meter_sq"): + def assign_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + loss_type="Device", + linear_loss=["1m_per_sec", "1m_per_sec", "1m_per_sec"], + quadratic_loss=[1, 1, 1], + linear_loss_free_area_ratio=[1, 1, 1], + quadratic_loss_free_area_ratio=[1, 1, 1], + power_law_constant=1, + power_law_exponent=1, + loss_curves_x=[[0, 1], [0, 1]], + loss_curves_y=[[0, 1], [0, 1]], + loss_curves_z=[[0, 1], [0, 1]], + loss_curve_flow_unit="m_per_sec", + loss_curve_pressure_unit="n_per_meter_sq", + ): """ Assign resistance boundary condition. @@ -5241,28 +5222,38 @@ def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid Examples -------- """ - props = {"Objects": objects if isinstance(objects, list) else [objects], "Fluid Material": fluid, - "Laminar Flow": laminar} + props = { + "Objects": objects if isinstance(objects, list) else [objects], + "Fluid Material": fluid, + "Laminar Flow": laminar, + } if loss_type == "Device": - for direction, linear, quadratic, linear_far, quadratic_far in zip(["X", "Y", "Z"], linear_loss, - quadratic_loss, - linear_loss_free_area_ratio, - quadratic_loss_free_area_ratio): - props.update({ - "Linear " + direction + " Coefficient": str(linear) + "m_per_sec" if not isinstance(linear, - str) else str( - linear), - "Quadratic " + direction + " Coefficient": str(quadratic), - "Linear " + direction + " Free Area Ratio": str(linear_far), - "Quadratic " + direction + " Free Area Ratio": str(quadratic_far) - }) + for direction, linear, quadratic, linear_far, quadratic_far in zip( + ["X", "Y", "Z"], + linear_loss, + quadratic_loss, + linear_loss_free_area_ratio, + quadratic_loss_free_area_ratio, + ): + props.update( + { + "Linear " + + direction + + " Coefficient": str(linear) + "m_per_sec" if not isinstance(linear, str) else str(linear), + "Quadratic " + direction + " Coefficient": str(quadratic), + "Linear " + direction + " Free Area Ratio": str(linear_far), + "Quadratic " + direction + " Free Area Ratio": str(quadratic_far), + } + ) elif loss_type == "Power Law": - props.update({ - "Pressure Loss Model": "Power Law", - "Power Law Coefficient": power_law_constant, - "Power Law Exponent": power_law_exponent - }) + props.update( + { + "Pressure Loss Model": "Power Law", + "Power Law Coefficient": power_law_constant, + "Power Law Exponent": power_law_exponent, + } + ) elif loss_type == "Loss Curve": props.update({"Pressure Loss Model": "Loss Curve"}) for direction, values in zip(["X", "Y", "Z"], [loss_curves_x, loss_curves_y, loss_curves_z]): @@ -5270,7 +5261,7 @@ def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid props[key] = { "DimUnits": [loss_curve_flow_unit, loss_curve_pressure_unit], "X": [str(i) for i in values[0]], - "Y": [str(i) for i in values[1]] + "Y": [str(i) for i in values[1]], } if isinstance(total_power, (dict, BoundaryDictionary)): @@ -5301,8 +5292,16 @@ def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid return None @pyaedt_function_handler() - def assign_power_law_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - power_law_constant=1, power_law_exponent=1): + def assign_power_law_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + power_law_constant=1, + power_law_exponent=1, + ): """ Assign resistance boundary condition prescribing a power law. @@ -5348,16 +5347,31 @@ def assign_power_law_resistance(self, objects, boundary_name=None, total_power=" Examples -------- """ - return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, - laminar=laminar, loss_type="Power Law", - power_law_constant=power_law_constant, power_law_exponent=power_law_exponent) + return self.assign_resistance( + objects, + boundary_name=boundary_name, + total_power=total_power, + fluid=fluid, + laminar=laminar, + loss_type="Power Law", + power_law_constant=power_law_constant, + power_law_exponent=power_law_exponent, + ) @pyaedt_function_handler() - def assign_loss_curve_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - loss_curves_x = [[0, 1], [0, 1]], - loss_curves_y = [[0, 1], [0, 1]], loss_curves_z = [[0, 1], [0, 1]], - loss_curve_flow_unit="m_per_sec", - loss_curve_pressure_unit="n_per_meter_sq"): + def assign_loss_curve_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + loss_curves_x=[[0, 1], [0, 1]], + loss_curves_y=[[0, 1], [0, 1]], + loss_curves_z=[[0, 1], [0, 1]], + loss_curve_flow_unit="m_per_sec", + loss_curve_pressure_unit="n_per_meter_sq", + ): """ Assign resistance boundary condition prescribing a loss curve. @@ -5421,16 +5435,33 @@ def assign_loss_curve_resistance(self, objects, boundary_name=None, total_power= Examples -------- """ - return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, - laminar=laminar, loss_type="Loss Curve", loss_curves_x=loss_curves_x, - loss_curves_y=loss_curves_y, loss_curves_z=loss_curves_z, - loss_curve_flow_unit=loss_curve_flow_unit, - loss_curve_pressure_unit=loss_curve_pressure_unit) + return self.assign_resistance( + objects, + boundary_name=boundary_name, + total_power=total_power, + fluid=fluid, + laminar=laminar, + loss_type="Loss Curve", + loss_curves_x=loss_curves_x, + loss_curves_y=loss_curves_y, + loss_curves_z=loss_curves_z, + loss_curve_flow_unit=loss_curve_flow_unit, + loss_curve_pressure_unit=loss_curve_pressure_unit, + ) @pyaedt_function_handler() - def assign_device_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - linear_loss = ["1m_per_sec", "1m_per_sec", "1m_per_sec"], quadratic_loss = [1, 1, 1], - linear_loss_free_area_ratio = [1, 1, 1], quadratic_loss_free_area_ratio = [1, 1, 1]): + def assign_device_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + linear_loss=["1m_per_sec", "1m_per_sec", "1m_per_sec"], + quadratic_loss=[1, 1, 1], + linear_loss_free_area_ratio=[1, 1, 1], + quadratic_loss_free_area_ratio=[1, 1, 1], + ): """ Assign resistance boundary condition using the device/approach model. @@ -5488,17 +5519,34 @@ def assign_device_resistance(self, objects, boundary_name=None, total_power="0W" Examples -------- """ - return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, - laminar=laminar, loss_type="Device", linear_loss=linear_loss, - quadratic_loss=quadratic_loss, - linear_loss_free_area_ratio = linear_loss_free_area_ratio, - quadratic_loss_free_area_ratio = quadratic_loss_free_area_ratio) + return self.assign_resistance( + objects, + boundary_name=boundary_name, + total_power=total_power, + fluid=fluid, + laminar=laminar, + loss_type="Device", + linear_loss=linear_loss, + quadratic_loss=quadratic_loss, + linear_loss_free_area_ratio=linear_loss_free_area_ratio, + quadratic_loss_free_area_ratio=quadratic_loss_free_area_ratio, + ) @pyaedt_function_handler() - def assign_recirculation_opening(self, face_list, extract_face, thermal_specification="Temperature", - assignment_value="0cel", conductance_external_temperature=None, - flow_specification="Mass Flow", flow_assignment="0kg_per_s_m2", - flow_direction=None, start_time=None, end_time=None, boundary_name=None): + def assign_recirculation_opening( + self, + face_list, + extract_face, + thermal_specification="Temperature", + assignment_value="0cel", + conductance_external_temperature=None, + flow_specification="Mass Flow", + flow_assignment="0kg_per_s_m2", + flow_direction=None, + start_time=None, + end_time=None, + boundary_name=None, + ): """Assign recirculation faces. Parameters @@ -5569,25 +5617,23 @@ def assign_recirculation_opening(self, face_list, extract_face, thermal_specific return False if conductance_external_temperature is not None and thermal_specification != "Conductance": self.logger.warning( - '``conductance_external_temperature`` does not have any effect unless the ``thermal_specification`` ' - 'is ``"Conductance"``.') + "``conductance_external_temperature`` does not have any effect unless the ``thermal_specification`` " + 'is ``"Conductance"``.' + ) if conductance_external_temperature is not None and thermal_specification != "Conductance": self.logger.warning( - '``conductance_external_temperature`` must be specified when ``thermal_specification`` ' - 'is ``"Conductance"``. Setting ``conductance_external_temperature`` to ``"AmbientTemp"``.') + "``conductance_external_temperature`` must be specified when ``thermal_specification`` " + 'is ``"Conductance"``. Setting ``conductance_external_temperature`` to ``"AmbientTemp"``.' + ) if (start_time is not None or end_time is not None) and not self.solution_type == "Transient": - self.logger.warning( - '``start_time`` and ``end_time`` only effect steady-state simulations.') + self.logger.warning("``start_time`` and ``end_time`` only effect steady-state simulations.") elif self.solution_type == "Transient" and not (start_time is not None and end_time is not None): self.logger.warning( - '``start_time`` and ``end_time`` should be declared for transient simulations. Setting them to "0s".') + '``start_time`` and ``end_time`` should be declared for transient simulations. Setting them to "0s".' + ) start_time = "0s" end_time = "0s" - assignment_dict = { - "Conductance": "Conductance", - "Heat Input": "Heat Flow", - "Temperature": "Temperature Change" - } + assignment_dict = {"Conductance": "Conductance", "Heat Input": "Heat Flow", "Temperature": "Temperature Change"} props = {} if not isinstance(face_list[0], int): face_list = [f.id for f in face_list] @@ -5648,9 +5694,19 @@ def assign_recirculation_opening(self, face_list, extract_face, thermal_specific return _create_boundary(bound) @pyaedt_function_handler() - def assign_blower_type1(self, faces, inlet_face, fan_curve_pressure, fan_curve_flow, blower_power="0W", blade_rpm=0, - blade_angle="0rad", fan_curve_pressure_unit="n_per_meter_sq", - fan_curve_flow_unit="m3_per_s", boundary_name=None): + def assign_blower_type1( + self, + faces, + inlet_face, + fan_curve_pressure, + fan_curve_flow, + blower_power="0W", + blade_rpm=0, + blade_angle="0rad", + fan_curve_pressure_unit="n_per_meter_sq", + fan_curve_flow_unit="m3_per_s", + boundary_name=None, + ): """Assign blower type 1. Parameters @@ -5711,13 +5767,31 @@ def assign_blower_type1(self, faces, inlet_face, fan_curve_pressure, fan_curve_f props["Blade RPM"] = blade_rpm props["Fan Blade Angle"] = blade_angle props["Blower Type"] = "Type 1" - return self._assign_blower(props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, - fan_curve_flow, fan_curve_pressure, blower_power, boundary_name) + return self._assign_blower( + props, + faces, + inlet_face, + fan_curve_flow_unit, + fan_curve_pressure_unit, + fan_curve_flow, + fan_curve_pressure, + blower_power, + boundary_name, + ) @pyaedt_function_handler() - def assign_blower_type2(self, faces, inlet_face, fan_curve_pressure, fan_curve_flow, blower_power="0W", - exhaust_angle="0rad", fan_curve_pressure_unit="n_per_meter_sq", - fan_curve_flow_unit="m3_per_s", boundary_name=None): + def assign_blower_type2( + self, + faces, + inlet_face, + fan_curve_pressure, + fan_curve_flow, + blower_power="0W", + exhaust_angle="0rad", + fan_curve_pressure_unit="n_per_meter_sq", + fan_curve_flow_unit="m3_per_s", + boundary_name=None, + ): """Assign blower type 2. Parameters @@ -5773,12 +5847,31 @@ def assign_blower_type2(self, faces, inlet_face, fan_curve_pressure, fan_curve_f props = {} props["Exhaust Exit Angle"] = exhaust_angle props["Blower Type"] = "Type 2" - return self._assign_blower(props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, - fan_curve_flow, fan_curve_pressure, blower_power, boundary_name) + return self._assign_blower( + props, + faces, + inlet_face, + fan_curve_flow_unit, + fan_curve_pressure_unit, + fan_curve_flow, + fan_curve_pressure, + blower_power, + boundary_name, + ) @pyaedt_function_handler() - def _assign_blower(self, props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, fan_curve_flow, - fan_curve_pressure, blower_power, boundary_name): + def _assign_blower( + self, + props, + faces, + inlet_face, + fan_curve_flow_unit, + fan_curve_pressure_unit, + fan_curve_flow, + fan_curve_pressure, + blower_power, + boundary_name, + ): if isinstance(faces[0], int): props["Faces"] = faces else: @@ -5800,11 +5893,21 @@ def _assign_blower(self, props, faces, inlet_face, fan_curve_flow_unit, fan_curv return _create_boundary(bound) @pyaedt_function_handler() - def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W", - thermal_specification="Thickness", thickness="1mm", solid_material="Al-Extruded", - conductance="0W_per_Cel", shell_conduction=False, thermal_resistance="0Kel_per_W", - low_side_rad_material=None, high_side_rad_material=None, - thermal_impedance="0celm2_per_W"): + def assign_conducting_plate( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thermal_specification="Thickness", + thickness="1mm", + solid_material="Al-Extruded", + conductance="0W_per_Cel", + shell_conduction=False, + thermal_resistance="0Kel_per_W", + low_side_rad_material=None, + high_side_rad_material=None, + thermal_impedance="0celm2_per_W", + ): """ Assign thermal boundary conditions to a conducting plate. @@ -5881,9 +5984,9 @@ def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W props["Total Power"] = total_power props["Thermal Specification"] = thermal_specification for value, key, unit in zip( - [thickness, conductance, thermal_resistance, thermal_impedance], - ["Thickness", "Conductance", "Thermal Resistance", "Thermal Impedance"], - ["mm", "W_per_Cel", "Kel_per_W", "Cel_m2_per_W"] + [thickness, conductance, thermal_resistance, thermal_impedance], + ["Thickness", "Conductance", "Thermal Resistance", "Thermal Impedance"], + ["mm", "W_per_Cel", "Kel_per_W", "Cel_m2_per_W"], ): if thermal_specification == key: if not isinstance(value, str): @@ -5894,25 +5997,32 @@ def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W if low_side_rad_material is not None: props["LowSide"] = {"Radiate": False} else: - props["LowSide"] = {"Radiate": True, - "RadiateTo": "AllObjects", - "Surface Material": low_side_rad_material} + props["LowSide"] = {"Radiate": True, "RadiateTo": "AllObjects", "Surface Material": low_side_rad_material} if high_side_rad_material is not None: props["LowSide"] = {"Radiate": False} else: - props["HighSide"] = {"Radiate": True, - "RadiateTo - High": "AllObjects - High", - "Surface Material - High": high_side_rad_material} + props["HighSide"] = { + "Radiate": True, + "RadiateTo - High": "AllObjects - High", + "Surface Material - High": high_side_rad_material, + } props["Shell Conduction"] = shell_conduction if not boundary_name: boundary_name = generate_unique_name("Plate") bound = BoundaryObject(self, boundary_name, props, "Conducting Plate") return _create_boundary(bound) - def assign_conducting_plate_with_thickness(self, obj_plate, boundary_name=None, total_power="0W", - thickness="1mm", solid_material="Al-Extruded", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + def assign_conducting_plate_with_thickness( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thickness="1mm", + solid_material="Al-Extruded", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with thickness specification to a conducting plate. @@ -5951,20 +6061,28 @@ def assign_conducting_plate_with_thickness(self, obj_plate, boundary_name=None, Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thickness", - thickness=thickness, - solid_material=solid_material, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) - - def assign_conducting_plate_with_resistance(self, obj_plate, boundary_name=None, total_power="0W", - thermal_resistance="0Kel_per_W", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thickness", + thickness=thickness, + solid_material=solid_material, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) + + def assign_conducting_plate_with_resistance( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thermal_resistance="0Kel_per_W", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with thermal resistance specification to a conducting plate. @@ -6000,19 +6118,27 @@ def assign_conducting_plate_with_resistance(self, obj_plate, boundary_name=None, Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thermal Resistance", - thermal_resistance=thermal_resistance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) - - def assign_conducting_plate_with_impedance(self, obj_plate, boundary_name=None, total_power="0W", - thermal_impedance="0celm2_per_W", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thermal Resistance", + thermal_resistance=thermal_resistance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) + + def assign_conducting_plate_with_impedance( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thermal_impedance="0celm2_per_W", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with thermal impedance specification to a conducting plate. @@ -6048,19 +6174,27 @@ def assign_conducting_plate_with_impedance(self, obj_plate, boundary_name=None, Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thermal Impedance", - thermal_impedance=thermal_impedance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) - - def assign_conducting_plate_with_conductance(self, obj_plate, boundary_name=None, total_power="0W", - conductance="0W_per_Cel", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thermal Impedance", + thermal_impedance=thermal_impedance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) + + def assign_conducting_plate_with_conductance( + self, + obj_plate, + boundary_name=None, + total_power="0W", + conductance="0W_per_Cel", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with conductance specification to a conducting plate. @@ -6096,14 +6230,16 @@ def assign_conducting_plate_with_conductance(self, obj_plate, boundary_name=None Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Conductance", - conductance=conductance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Conductance", + conductance=conductance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) @pyaedt_function_handler def __create_dataset_assignment(self, type_assignment, ds_name, scale): @@ -6312,3 +6448,177 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on Boundary dictionary object that can be passed to boundary condition assignment functions. """ return SquareWaveDictionary(on_value, initial_time_off, on_time, off_time, off_value) + + +class IcepakDesignSettings: + def __init__( + self, + app, + gravity_dir=0, + ambient_temperature=20, + perform_validation=False, + check_level="None", + default_fluid="air", + default_solid="Al-Extruded", + export_monitor=False, + export_directory=os.getcwd(), + gauge_pressure=0, + radiation_temperature=20, + ignore_unclassified_objects=False, + skip_intersection_checks=False, + ): + self._app = app + self.gravity_direction = gravity_dir + self.ambient_temperature = ambient_temperature + self.perform_validation = perform_validation + self.check_level = check_level + self.default_fluid = default_fluid + self.default_solid = default_solid + self.export_monitor = export_monitor + self.export_directory = export_directory + self.gauge_pressure = gauge_pressure + self.radiation_temperature = radiation_temperature + self.ignore_unclassified_objects = ignore_unclassified_objects + self.skip_intersection_checks = skip_intersection_checks + + @property + def gravity_direction(self): + return ["-", "+"][int(True)] + self._gravity_direction + + @gravity_direction.setter + def gravity_direction(self, value): + if isinstance(value, int): + gravity_directions = ["X", "Y", "Z"] + if value > 2: + self._gravity_positive = True + self._gravity_direction = gravity_directions[value - 3] + else: + self._gravity_positive = False + self._gravity_direction = gravity_directions[value] + elif isinstance(value, str): + gravity_direction = None + gravity_positive = None + if len(value) == 2: + if value[1].lower() in ["x", "y", "z"]: + gravity_direction = value[1].upper() + if value[0] in ["-", "+"]: + gravity_positive = value[0] == "+" + if gravity_direction is not None and gravity_positive is not None: + self._gravity_direction = gravity_direction + self._gravity_positive = gravity_positive + else: + self._app.logger.error("Gravity value {} not valid.".format(value)) + + @property + def ambient_temperature(self): + return self._ambient_temperature + + @ambient_temperature.setter + def ambient_temperature(self, value): + if isinstance(value, (dict, BoundaryDictionary)): + if not self._app.solution_type == "Transient": + self._app.logger.error("Transient assignment is supported only in transient designs.") + ambtemp = getattr(self._app, "_parse_variation_data")( + "AmbientTemperature", + "Transient", + variation_value=value["Values"], + function=value["Function"], + ) + if ambtemp is not None: + self._ambient_temperature = ambtemp + else: + self._app.logger.error("Transient dictionary is not valid.") + else: + self._ambient_temperature = (self._app.value_with_units(value, "cel"),) + + @property + def default_fluid_material(self): + return self._default_fluid_material + + @default_fluid_material.setter + def default_fluid_material(self, value): + if isinstance(value, pyaedt.modules.Material.Material): + value = value.name + if self._app.materials[value]: + self._default_fluid_material = value + + @property + def default_solid_material(self): + return self._default_solid_material + + @default_solid_material.setter + def default_solid_material(self, value): + if isinstance(value, pyaedt.modules.Material.Material): + value = value.name + if self._app.materials[value]: + self._default_solid_material = value + + @property + def default_surface_material(self): + return self._default_surface_material + + @default_surface_material.setter + def default_surface_material(self, value): + if isinstance(value, pyaedt.modules.Material.Material): + value = value.name + if self._app.materials[value]: + self._default_surface_material = value + + @property + def gauge_pressure(self): + return self._gauge_pressure + + @gauge_pressure.setter + def gauge_pressure(self, value): + self._gauge_pressure = (self._app.value_with_units(value, "n_per_meter_sq"),) + + @property + def radiation_temperature(self): + return self._radiation_temperature + + @radiation_temperature.setter + def radiation_temperature(self, value): + self._radiation_temperature = self._app.value_with_units(value, "cel") + + @property + def check_level(self): + return self._check_value + + @check_level.setter + def check_level(self, value): + available_vals = ["None", "Basic", "Strict", "WarningOnly"] + if value in available_vals: + self._check_value = value + else: + self._app.logger.error("{} option not valid. Valid options are {}.".format(value, available_vals)) + + def update(self): + a = _dict2arg( + { + "Design Settings Data": { + "Perform Minimal validation": self.perform_validation, + "Default Fluid Material": self.default_fluid_material, + "Default Solid Material": self.default_solid_material, + "Default Surface Material": self.default_surface_material, + "AmbientTemperature": self.ambient_temperature, + "AmbientPressure": self.gauge_pressure, + "AmbientRadiationTemperature": self.radiation_temperature, + "Gravity Vector CS ID": 1, # TODO: how to get cs id? + "Gravity Vector Axis": self._gravity_direction, + "Positive": self._gravity_positive, + "ExportOnSimulationComplete": self.export_monitor, + "ExportDirectory": self.export_directory, + } + } + ) + b = _dict2arg( + { + "Model Validation Settings": { + "EntityCheckLevel": self.check_level, + "IgnoreUnclassifiedObjects": self.ignore_unclassified_objects, + "SkipIntersectionChecks": self.skip_intersection_checks, + } + } + ) + self._app.odesign.SetDesignSettings(a, b) + return True From 208189d2eb882891b838cf35cf427cdeba5bed02 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Tue, 23 Apr 2024 15:13:09 +0200 Subject: [PATCH 02/22] Add DesignSettingsClass --- _unittest/test_98_Icepak.py | 22 ++++ pyaedt/application/Design.py | 73 ++++++++---- pyaedt/icepak.py | 217 +++++++---------------------------- 3 files changed, 114 insertions(+), 198 deletions(-) diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index 212ea79b7d9..bc862130f03 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -1583,3 +1583,25 @@ def test_74_boundary_conditions_dictionaries(self): def test_75_native_component_load(self, add_app): app = add_app(application=Icepak, project_name=native_import, subfolder=test_subfolder) assert len(app.native_components) == 1 + + def test_76_design_settings(self): + d = self.aedtapp.design_settings + d["AmbTemp"] = 5 + assert d["AmbTemp"] == "5cel" + d["AmbTemp"] = "5kel" + assert d["AmbTemp"] == "5kel" + d["AmbTemp"] = {"1": "2"} + assert d["AmbTemp"] == "5kel" + d["AmbGaugePressure"] = 5 + assert d["AmbGaugePressure"] == "5n_per_meter_sq" + d["GravityVec"] = 1 + assert d["GravityVec"] == "Global::Y" + assert d["GravityDir"] == "Positive" + d["GravityVec"] = 4 + assert d["GravityVec"] == "Global::Y" + assert d["GravityDir"] == "Negative" + d["GravityVec"] = "+X" + assert d["GravityVec"] == "Global::X" + assert d["GravityDir"] == "Positive" + d["GravityVec"] = "Global::Y" + assert d["GravityVec"] == "Global::Y" diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index d342707ea54..a234756cdbe 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -39,6 +39,7 @@ from pyaedt.generic.LoadAEDTFile import load_entire_aedt_file from pyaedt.generic.constants import AEDT_UNITS from pyaedt.generic.constants import unit_system +from pyaedt.generic.general_methods import GrpcApiError from pyaedt.generic.general_methods import check_and_download_file from pyaedt.generic.general_methods import generate_unique_name from pyaedt.generic.general_methods import is_ironpython @@ -4020,32 +4021,60 @@ def set_temporary_directory(self, temp_dir_path): return True @pyaedt_function_handler() + def _manipulate_design_settings_inputs(self, k, v): + pass + + @property def design_settings(self): - """Get design settings for the current AEDT app. + return DesignSettings(self, self._manipulate_design_settings_inputs) - Returns - ------- - dict - Dictionary of valid design settings. - References - ---------- +class DesignSettings: + """Get design settings for the current AEDT app. - >>> oDesign.GetChildObject("Design Settings") - """ + References + ---------- + + >>> oDesign.GetChildObject("Design Settings") + """ + + def __init__(self, app, manipulate_inputs): + self._app = app + self._manipulate_inputs = manipulate_inputs try: - design_settings = self._odesign.GetChildObject("Design Settings") - except Exception: # pragma: no cover - self.logger.error("Failed to retrieve design settings.") - return False + self.design_settings = self._app.odesign.GetChildObject("Design Settings") + except GrpcApiError: # pragma: no cover + self._app.logger.error("Failed to retrieve design settings.") + self.design_settings = None - prop_name_list = design_settings.GetPropNames() - design_settings_dict = {} - for prop in prop_name_list: - try: - design_settings_dict[prop] = design_settings.GetPropValue(prop) - except Exception: # pragma: no cover - self.logger.warning('Could not retrieve "{}" property value in design settings.'.format(prop)) - design_settings_dict[prop] = None + @property + def available_properties(self): + return [prop for prop in self.design_settings.GetPropNames() if not prop.endswith("/Choices")] + + def __repr__(self): + design_settings = {} + for prop in self.available_properties: + design_settings[prop] = self.design_settings.GetPropValue(prop) + return f"{design_settings}" + + def __setitem__(self, key, value): + if key in self.available_properties: + value = self._manipulate_inputs(key, value) + key_choices = "{}/Choices".format(key) + if key_choices in self.design_settings.GetPropNames(): + value_choices = self.design_settings.GetPropValue(key_choices) + if value not in value_choices: + self._app.logger.error( + "{} is not a valid choice. Possible choices are: {}".format(value, ", ".join(value_choices)) + ) + return False + self.design_settings.SetPropValue(key, value) + else: + self._app.logger.error("{} property not available in design settings.".format(key)) - return design_settings_dict + def __getitem__(self, key): + if key in self.available_properties: + return self.design_settings.GetPropValue(key) + else: + self._app.logger.error("{} property not available in design settings.".format(key)) + return None diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 0029cbe9921..064d0da361f 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -12,7 +12,6 @@ from pyaedt.generic.general_methods import GrpcApiError from pyaedt.modeler.cad.elements3d import FacePrimitive from pyaedt.modeler.geometry_operators import GeometryOperators as go -import pyaedt.modules.Material from pyaedt.modules.SetupTemplates import SetupKeys if is_linux and is_ironpython: @@ -24,7 +23,6 @@ from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.generic.DataHandlers import _arg2dict -from pyaedt.generic.DataHandlers import _dict2arg from pyaedt.generic.DataHandlers import random_string from pyaedt.generic.configurations import ConfigurationsIcepak from pyaedt.generic.general_methods import generate_unique_name @@ -176,14 +174,14 @@ def __init__( ) self._monitor = Monitor(self) self._configurations = ConfigurationsIcepak(self) - self._design_settins = IcepakDesignSettings(self) + # self._design_settins = IcepakDesignSettings(self) def _init_from_design(self, *args, **kwargs): self.__init__(*args, **kwargs) - @property - def design_settings(self): - return self._design_settins + # @property + # def design_settings(self): + # return self._design_settins @property def problem_type(self): @@ -6449,176 +6447,43 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on """ return SquareWaveDictionary(on_value, initial_time_off, on_time, off_time, off_value) - -class IcepakDesignSettings: - def __init__( - self, - app, - gravity_dir=0, - ambient_temperature=20, - perform_validation=False, - check_level="None", - default_fluid="air", - default_solid="Al-Extruded", - export_monitor=False, - export_directory=os.getcwd(), - gauge_pressure=0, - radiation_temperature=20, - ignore_unclassified_objects=False, - skip_intersection_checks=False, - ): - self._app = app - self.gravity_direction = gravity_dir - self.ambient_temperature = ambient_temperature - self.perform_validation = perform_validation - self.check_level = check_level - self.default_fluid = default_fluid - self.default_solid = default_solid - self.export_monitor = export_monitor - self.export_directory = export_directory - self.gauge_pressure = gauge_pressure - self.radiation_temperature = radiation_temperature - self.ignore_unclassified_objects = ignore_unclassified_objects - self.skip_intersection_checks = skip_intersection_checks - - @property - def gravity_direction(self): - return ["-", "+"][int(True)] + self._gravity_direction - - @gravity_direction.setter - def gravity_direction(self, value): - if isinstance(value, int): - gravity_directions = ["X", "Y", "Z"] - if value > 2: - self._gravity_positive = True - self._gravity_direction = gravity_directions[value - 3] + @pyaedt_function_handler() + def _manipulate_design_settings_inputs(self, k, v): + if k in ["AmbTemp", "AmbRadTemp"]: + if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)): + self.logger.error("Failed. Use `edit_design_settings` function.") + return self.design_settings["AmbTemp"] + # Bug in native API. Uncomment when fixed + # if not self.solution_type == "Transient": + # self.logger.error("Transient assignment is supported only in transient designs.") + # return False + # ambtemp = getattr(self, "_parse_variation_data")( + # "AmbientTemperature", + # "Transient", + # variation_value=v["Values"], + # function=v["Function"], + # ) + # if ambtemp is not None: + # return ambtemp + # else: + # self.logger.error("Transient dictionary is not valid.") + # return False else: - self._gravity_positive = False - self._gravity_direction = gravity_directions[value] - elif isinstance(value, str): - gravity_direction = None - gravity_positive = None - if len(value) == 2: - if value[1].lower() in ["x", "y", "z"]: - gravity_direction = value[1].upper() - if value[0] in ["-", "+"]: - gravity_positive = value[0] == "+" - if gravity_direction is not None and gravity_positive is not None: - self._gravity_direction = gravity_direction - self._gravity_positive = gravity_positive + return self.value_with_units(v, "cel") + elif k == "AmbGaugePressure": + return self.value_with_units(v, "n_per_meter_sq") + elif k == "GravityVec": + if isinstance(v, (float, int)): + self.design_settings["GravityDir"] = ["Positive", "Negative"][v // 3] + v = "Global::{}".format(["X", "Y", "Z"][v - v // 3 * 3]) + return v else: - self._app.logger.error("Gravity value {} not valid.".format(value)) - - @property - def ambient_temperature(self): - return self._ambient_temperature - - @ambient_temperature.setter - def ambient_temperature(self, value): - if isinstance(value, (dict, BoundaryDictionary)): - if not self._app.solution_type == "Transient": - self._app.logger.error("Transient assignment is supported only in transient designs.") - ambtemp = getattr(self._app, "_parse_variation_data")( - "AmbientTemperature", - "Transient", - variation_value=value["Values"], - function=value["Function"], - ) - if ambtemp is not None: - self._ambient_temperature = ambtemp - else: - self._app.logger.error("Transient dictionary is not valid.") - else: - self._ambient_temperature = (self._app.value_with_units(value, "cel"),) - - @property - def default_fluid_material(self): - return self._default_fluid_material - - @default_fluid_material.setter - def default_fluid_material(self, value): - if isinstance(value, pyaedt.modules.Material.Material): - value = value.name - if self._app.materials[value]: - self._default_fluid_material = value - - @property - def default_solid_material(self): - return self._default_solid_material - - @default_solid_material.setter - def default_solid_material(self, value): - if isinstance(value, pyaedt.modules.Material.Material): - value = value.name - if self._app.materials[value]: - self._default_solid_material = value - - @property - def default_surface_material(self): - return self._default_surface_material - - @default_surface_material.setter - def default_surface_material(self, value): - if isinstance(value, pyaedt.modules.Material.Material): - value = value.name - if self._app.materials[value]: - self._default_surface_material = value - - @property - def gauge_pressure(self): - return self._gauge_pressure - - @gauge_pressure.setter - def gauge_pressure(self, value): - self._gauge_pressure = (self._app.value_with_units(value, "n_per_meter_sq"),) - - @property - def radiation_temperature(self): - return self._radiation_temperature - - @radiation_temperature.setter - def radiation_temperature(self, value): - self._radiation_temperature = self._app.value_with_units(value, "cel") - - @property - def check_level(self): - return self._check_value - - @check_level.setter - def check_level(self, value): - available_vals = ["None", "Basic", "Strict", "WarningOnly"] - if value in available_vals: - self._check_value = value + if len(v.split("::")) == 1 and len(v) < 3: + if v.startswith("+") or v.startswith("-"): + self.design_settings["GravityDir"] = ["Positive", "Negative"][int(v.startswith("-"))] + v = v[-1] + return "Global::{}".format(v) + else: + return v else: - self._app.logger.error("{} option not valid. Valid options are {}.".format(value, available_vals)) - - def update(self): - a = _dict2arg( - { - "Design Settings Data": { - "Perform Minimal validation": self.perform_validation, - "Default Fluid Material": self.default_fluid_material, - "Default Solid Material": self.default_solid_material, - "Default Surface Material": self.default_surface_material, - "AmbientTemperature": self.ambient_temperature, - "AmbientPressure": self.gauge_pressure, - "AmbientRadiationTemperature": self.radiation_temperature, - "Gravity Vector CS ID": 1, # TODO: how to get cs id? - "Gravity Vector Axis": self._gravity_direction, - "Positive": self._gravity_positive, - "ExportOnSimulationComplete": self.export_monitor, - "ExportDirectory": self.export_directory, - } - } - ) - b = _dict2arg( - { - "Model Validation Settings": { - "EntityCheckLevel": self.check_level, - "IgnoreUnclassifiedObjects": self.ignore_unclassified_objects, - "SkipIntersectionChecks": self.skip_intersection_checks, - } - } - ) - self._app.odesign.SetDesignSettings(a, b) - return True + return v From 3ced010b7e93234d3d272955fcc3ba441563dd69 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Tue, 23 Apr 2024 15:18:38 +0200 Subject: [PATCH 03/22] Revert "Add IcepakDesignSettings class" This reverts commit eb7b0e64 --- pyaedt/icepak.py | 1034 ++++++++++++++++++++-------------------------- 1 file changed, 443 insertions(+), 591 deletions(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 064d0da361f..3499f47c8b5 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -174,15 +174,10 @@ def __init__( ) self._monitor = Monitor(self) self._configurations = ConfigurationsIcepak(self) - # self._design_settins = IcepakDesignSettings(self) def _init_from_design(self, *args, **kwargs): self.__init__(*args, **kwargs) - # @property - # def design_settings(self): - # return self._design_settins - @property def problem_type(self): """Problem type of the Icepak design. Options are ``"TemperatureAndFlow"``, ``"TemperatureOnly"``, @@ -1610,27 +1605,25 @@ def create_parametric_heatsink_on_face( hs.name = hs_name return hs, name_map - @pyaedt_function_handler( - ambtemp="ambient_temperature", - performvalidation="perform_validation", - defaultfluid="default_fluid", - defaultsolid="default_solid", - ) + # fmt: off + @pyaedt_function_handler() def edit_design_settings( - self, - gravity_dir=0, - ambient_temperature=20, - perform_validation=False, - check_level="None", - default_fluid="air", - default_solid="Al-Extruded", - export_monitor=False, - export_directory=os.getcwd(), - gauge_pressure=0, - radiation_temperature=20, - ignore_unclassified_objects=False, - skip_intersection_checks=False, + self, + gravity_dir=0, + ambtemp=20, + performvalidation=False, + check_level="None", + defaultfluid="air", + defaultsolid="Al-Extruded", + export_monitor=False, + export_directory=os.getcwd(), + gauge_pressure=0, + radiation_temperature=20, + ignore_unclassified_objects=False, + skip_intersection_checks=False, + **kwargs ): + # fmt: on """Update the main settings of the design. Parameters @@ -1638,20 +1631,17 @@ def edit_design_settings( gravity_dir : int, optional Gravity direction from -X to +Z. Options are ``0`` to ``5``. The default is ``0``. - ambient_temperature : float, str or BoundaryDictionary, optional + ambtemp : float, str, optional Ambient temperature. The default is ``20``. - The default unit is Celsius for ``float`` or ``str`` including unit - definition is accepted, e.g. ``325kel``. - :class:`pyaedt.modules.Boundary.BoundaryDictionary` objects can be used - for transient assignments. - perform_validation : bool, optional + The default unit is celsius for float or string including unit definition is accepted, e.g. ``325kel``. + performvalidation : bool, optional Whether to perform validation. The default is ``False``. check_level : str, optional Level of check to perform during validation. The default is ``"None"``. - default_fluid : str, optional + defaultfluid : str, optional Default fluid material. The default is ``"air"``. - default_solid : str, optional + defaultsolid : str, optional Default solid material. The default is ``"Al-Extruded"``. export_monitor : bool, optional Whether to use the default export directory for monitor point data. @@ -1680,33 +1670,68 @@ def edit_design_settings( >>> oDesign.SetDesignSettings """ - self.design_settings.ambient_temperature = ambient_temperature - self.design_settings.gravity_direction = gravity_dir - self.design_settings.default_fluid_material = default_fluid - self.design_settings.default_solid_material = default_solid - self.design_settings.perform_validation = perform_validation - self.design_settings.check_level = check_level - self.design_settings.export_monitor = export_monitor - self.design_settings.export_directory = export_directory - self.design_settings.gauge_pressure = gauge_pressure - self.design_settings.radiation_temperature = radiation_temperature - self.design_settings.ignore_unclassified_objects = ignore_unclassified_objects - self.design_settings.skip_intersection_checks = skip_intersection_checks - return self.design_settings.update() - - @pyaedt_function_handler( - designname="design", setupname="setup", sweepname="sweep", paramlist="parameters", object_list="assignment" - ) + # + # Configure design settings for gravity etc + IceGravity = ["X", "Y", "Z"] + GVPos = False + if int(gravity_dir) > 2: + GVPos = True + GVA = IceGravity[int(gravity_dir) - 3] + self._odesign.SetDesignSettings( + [ + "NAME:Design Settings Data", + "Perform Minimal validation:=", + perform_validation, + "Default Fluid Material:=", + default_fluid, + "Default Solid Material:=", + default_solid, + "Default Surface Material:=", + "Steel-oxidised-surface", + "AmbientTemperature:=", + self.value_with_units(ambtemp, "cel"), + "AmbientPressure:=", + self.value_with_units(gauge_pressure, "n_per_meter_sq"), + "AmbientRadiationTemperature:=", + self.value_with_units(radiation_temperature, "cel"), + "Gravity Vector CS ID:=", + 1, + "Gravity Vector Axis:=", + GVA, + "Positive:=", + GVPos, + "ExportOnSimulationComplete:=", + export_monitor, + "ExportDirectory:=", + export_directory, + ], + [ + "NAME:Model Validation Settings", + "EntityCheckLevel:=", + check_level, + "IgnoreUnclassifiedObjects:=", + ignore_unclassified_objects, + "SkipIntersectionChecks:=", + skip_intersection_checks, + ], + ) + return True + + @pyaedt_function_handler(designname="design", + setupname="setup", + sweepname="sweep", + paramlist="parameters", + object_list="assignment") def assign_em_losses( - self, - design="HFSSDesign1", - setup="Setup1", - sweep="LastAdaptive", - map_frequency=None, - surface_objects=None, - source_project_name=None, - parameters=None, - assignment=None, + self, + design="HFSSDesign1", + setup="Setup1", + sweep="LastAdaptive", + map_frequency=None, + surface_objects=None, + source_project_name=None, + parameters=None, + assignment=None, ): """Map EM losses to an Icepak design. @@ -1811,13 +1836,13 @@ def assign_em_losses( @pyaedt_function_handler() def eval_surface_quantity_from_field_summary( - self, - faces_list, - quantity_name="HeatTransCoeff", - savedir=None, - filename=None, - sweep_name=None, - parameter_dict_with_values={}, + self, + faces_list, + quantity_name="HeatTransCoeff", + savedir=None, + filename=None, + sweep_name=None, + parameter_dict_with_values={}, ): """Export the field surface output. @@ -1884,13 +1909,13 @@ def eval_surface_quantity_from_field_summary( return filename def eval_volume_quantity_from_field_summary( - self, - object_list, - quantity_name="HeatTransCoeff", - savedir=None, - filename=None, - sweep_name=None, - parameter_dict_with_values={}, + self, + object_list, + quantity_name="HeatTransCoeff", + savedir=None, + filename=None, + sweep_name=None, + parameter_dict_with_values={}, ): """Export the field volume output. @@ -1955,16 +1980,16 @@ def eval_volume_quantity_from_field_summary( return filename def export_summary( - self, - output_dir=None, - solution_name=None, - type="Object", - geometry_type="Volume", - quantity="Temperature", - variation="", - variation_list=None, - filename="IPKsummaryReport", - **kwargs, + self, + output_dir=None, + solution_name=None, + type="Object", + geometry_type="Volume", + quantity="Temperature", + variation="", + variation_list=None, + filename="IPKsummaryReport", + **kwargs ): """Export a fields summary of all objects. @@ -2001,16 +2026,16 @@ def export_summary( >>> oModule.EditFieldsSummarySetting >>> oModule.ExportFieldsSummary """ - if "geometryType" in kwargs: - warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", DeprecationWarning) + if 'geometryType' in kwargs: + warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", + DeprecationWarning) - if "variationlist" in kwargs: - warnings.warn( - "The 'variationlist' argument is deprecated. Use 'variation_list' instead.", DeprecationWarning - ) + if 'variationlist' in kwargs: + warnings.warn("The 'variationlist' argument is deprecated. Use 'variation_list' instead.", + DeprecationWarning) - geometry_type = kwargs.get("geometryType", geometry_type) - variation_list = kwargs.get("variationlist", variation_list) + geometry_type = kwargs.get('geometryType', geometry_type) + variation_list = kwargs.get('variationlist', variation_list) if variation_list is None: variation_list = [] @@ -2162,14 +2187,14 @@ def get_link_data(self, links_data, **kwargs): @pyaedt_function_handler() def create_fan( - self, - name=None, - is_2d=False, - shape="Circular", - cross_section="XY", - radius="0.008mm", - hub_radius="0mm", - origin=None, + self, + name=None, + is_2d=False, + shape="Circular", + cross_section="XY", + radius="0.008mm", + hub_radius="0mm", + origin=None, ): """Create a fan component in Icepak that is linked to an HFSS 3D Layout object. @@ -2263,7 +2288,7 @@ def create_fan( "MaterialDefinitionParameters": OrderedDict({"VariableOrders": OrderedDict()}), "MapInstanceParameters": "DesignVariable", "UniqueDefinitionIdentifier": "57c8ab4e-4db9-4881-b6bb-" - + random_string(12, char_set="abcdef0123456789"), + + random_string(12, char_set="abcdef0123456789"), "OriginFilePath": "", "IsLocal": False, "ChecksumString": "", @@ -2297,7 +2322,7 @@ def create_fan( @pyaedt_function_handler() def create_ipk_3dcomponent_pcb( - self, + self, compName, setupLinkInfo, solutionFreq, @@ -2451,7 +2476,7 @@ def create_ipk_3dcomponent_pcb( @pyaedt_function_handler() def create_pcb_from_3dlayout( - self, + self, component_name, project_name, design_name, @@ -2621,15 +2646,15 @@ def copyGroupFrom(self, group_name, source_design, source_project_name=None, sou @pyaedt_function_handler() def globalMeshSettings( - self, - meshtype, - gap_min_elements="1", - noOgrids=False, - MLM_en=True, - MLM_Type="3D", - stairStep_en=False, - edge_min_elements="1", - object="Region", + self, + meshtype, + gap_min_elements="1", + noOgrids=False, + MLM_en=True, + MLM_Type="3D", + stairStep_en=False, + edge_min_elements="1", + object="Region", ): """Create a custom mesh tailored on a PCB design. @@ -2718,7 +2743,7 @@ def globalMeshSettings( @pyaedt_function_handler() def create_meshregion_component( - self, scale_factor=1.0, name="Component_Region", restore_padding_values=[50, 50, 50, 50, 50, 50] + self, scale_factor=1.0, name="Component_Region", restore_padding_values=[50, 50, 50, 50, 50, 50] ): """Create a bounding box to use as a mesh region in Icepak. @@ -2865,14 +2890,14 @@ def get_gas_objects(self): @pyaedt_function_handler() def generate_fluent_mesh( - self, - object_lists=None, - meshtype="tetrahedral", - min_size=None, - max_size=None, - inflation_layer_number=3, - inflation_growth_rate=1.2, - mesh_growth_rate=1.2, + self, + object_lists=None, + meshtype="tetrahedral", + min_size=None, + max_size=None, + inflation_layer_number=3, + inflation_growth_rate=1.2, + mesh_growth_rate=1.2, ): """Generate a Fluent mesh for a list of selected objects and assign the mesh automatically to the objects. @@ -3031,13 +3056,13 @@ def generate_fluent_mesh( @pyaedt_function_handler() def apply_icepak_settings( - self, - ambienttemp=20, - gravityDir=5, - perform_minimal_val=True, - default_fluid="air", - default_solid="Al-Extruded", - default_surface="Steel-oxidised-surface", + self, + ambienttemp=20, + gravityDir=5, + perform_minimal_val=True, + default_fluid="air", + default_solid="Al-Extruded", + default_surface="Steel-oxidised-surface", ): """Apply Icepak default design settings. @@ -3165,31 +3190,31 @@ def assign_surface_material(self, obj, mat): @pyaedt_function_handler() def import_idf( - self, - board_path, - library_path=None, - control_path=None, - filter_cap=False, - filter_ind=False, - filter_res=False, - filter_height_under=None, - filter_height_exclude_2d=False, - power_under=None, - create_filtered_as_non_model=False, - high_surface_thick="0.07mm", - low_surface_thick="0.07mm", - internal_thick="0.07mm", - internal_layer_number=2, - high_surface_coverage=30, - low_surface_coverage=30, - internal_layer_coverage=30, - trace_material="Cu-Pure", - substrate_material="FR-4", - create_board=True, - model_board_as_rect=False, - model_device_as_rect=True, - cutoff_height="5mm", - component_lib="", + self, + board_path, + library_path=None, + control_path=None, + filter_cap=False, + filter_ind=False, + filter_res=False, + filter_height_under=None, + filter_height_exclude_2d=False, + power_under=None, + create_filtered_as_non_model=False, + high_surface_thick="0.07mm", + low_surface_thick="0.07mm", + internal_thick="0.07mm", + internal_layer_number=2, + high_surface_coverage=30, + low_surface_coverage=30, + internal_layer_coverage=30, + trace_material="Cu-Pure", + substrate_material="FR-4", + create_board=True, + model_board_as_rect=False, + model_device_as_rect=True, + cutoff_height="5mm", + component_lib="", ): """Import an IDF file into an Icepak design. @@ -3469,33 +3494,33 @@ def get_face_normal(obj_face): @pyaedt_function_handler() def assign_stationary_wall( - self, - geometry, - boundary_condition, - name=None, - temperature="0cel", - heat_flux="0irrad_W_per_m2", - thickness="0mm", - htc="0w_per_m2kel", - ref_temperature="AmbientTemp", - material="Al-Extruded", # relevant if th>0 - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", # relevant if radiate = False - ht_correlation=False, - ht_correlation_type="Natural Convection", - ht_correlation_fluid="air", - ht_correlation_flow_type="Turbulent", - ht_correlation_flow_direction="X", - ht_correlation_value_type="Average Values", # "Local Values" - ht_correlation_free_stream_velocity="1m_per_sec", - ht_correlation_surface="Vertical", # Top, Bottom, Vertical - ht_correlation_amb_temperature="AmbientTemp", - shell_conduction=False, - ext_surf_rad=False, - ext_surf_rad_material="Stainless-steel-cleaned", - ext_surf_rad_ref_temp="AmbientTemp", - ext_surf_rad_view_factor="1", - **kwargs, + self, + geometry, + boundary_condition, + name=None, + temperature="0cel", + heat_flux="0irrad_W_per_m2", + thickness="0mm", + htc="0w_per_m2kel", + ref_temperature="AmbientTemp", + material="Al-Extruded", # relevant if th>0 + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", # relevant if radiate = False + ht_correlation=False, + ht_correlation_type="Natural Convection", + ht_correlation_fluid="air", + ht_correlation_flow_type="Turbulent", + ht_correlation_flow_direction="X", + ht_correlation_value_type="Average Values", # "Local Values" + ht_correlation_free_stream_velocity="1m_per_sec", + ht_correlation_surface="Vertical", # Top, Bottom, Vertical + ht_correlation_amb_temperature="AmbientTemp", + shell_conduction=False, + ext_surf_rad=False, + ext_surf_rad_material="Stainless-steel-cleaned", + ext_surf_rad_ref_temp="AmbientTemp", + ext_surf_rad_view_factor="1", + **kwargs ): """Assign surface wall boundary condition. @@ -3645,22 +3670,18 @@ def assign_stationary_wall( props["Solid Material"] = material props["External Condition"] = boundary_condition if "htc_dataset" in kwargs: # backward compatibility - warnings.warn( - "``htc_dataset`` argument is being deprecated. Create a dictionary as per" - "documentation and assign it to the ``htc`` argument.", - DeprecationWarning, - ) + warnings.warn("``htc_dataset`` argument is being deprecated. Create a dictionary as per" + "documentation and assign it to the ``htc`` argument.", DeprecationWarning) if kwargs["htc_dataset"] is not None: - htc = { - "Type": "Temp Dep", - "Function": "Piecewise Linear", - "Values": kwargs["htc_dataset"], - } + htc = {"Type": "Temp Dep", + "Function": "Piecewise Linear", + "Values": kwargs["htc_dataset"], + } for quantity, assignment_value, to_add in [ ("External Radiation Reference Temperature", ext_surf_rad_ref_temp, ext_surf_rad), ("Heat Transfer Coefficient", htc, boundary_condition == "Heat Transfer Coefficient"), ("Temperature", temperature, boundary_condition == "Temperature"), - ("Heat Flux", heat_flux, boundary_condition == "Heat Flux"), + ("Heat Flux", heat_flux, boundary_condition == "Heat Flux") ]: if to_add: if isinstance(assignment_value, (dict, BoundaryDictionary)): @@ -3713,15 +3734,15 @@ def assign_stationary_wall( @pyaedt_function_handler() def assign_stationary_wall_with_heat_flux( - self, - geometry, - name=None, - heat_flux="0irrad_W_per_m2", - thickness="0mm", - material="Al-Extruded", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, + self, + geometry, + name=None, + heat_flux="0irrad_W_per_m2", + thickness="0mm", + material="Al-Extruded", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, ): """Assign a surface wall boundary condition with specified heat flux. @@ -3775,15 +3796,15 @@ def assign_stationary_wall_with_heat_flux( @pyaedt_function_handler() def assign_stationary_wall_with_temperature( - self, - geometry, - name=None, - temperature="0cel", - thickness="0mm", - material="Al-Extruded", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, + self, + geometry, + name=None, + temperature="0cel", + thickness="0mm", + material="Al-Extruded", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, ): """Assign a surface wall boundary condition with specified temperature. @@ -3838,30 +3859,30 @@ def assign_stationary_wall_with_temperature( @pyaedt_function_handler() def assign_stationary_wall_with_htc( - self, - geometry, - name=None, - thickness="0mm", - material="Al-Extruded", - htc="0w_per_m2kel", - ref_temperature="AmbientTemp", - ht_correlation=False, - ht_correlation_type="Natural Convection", - ht_correlation_fluid="air", - ht_correlation_flow_type="Turbulent", - ht_correlation_flow_direction="X", - ht_correlation_value_type="Average Values", - ht_correlation_free_stream_velocity="1m_per_sec", - ht_correlation_surface="Vertical", - ht_correlation_amb_temperature="AmbientTemp", - ext_surf_rad=False, - ext_surf_rad_material="Stainless-steel-cleaned", - ext_surf_rad_ref_temp="AmbientTemp", - ext_surf_rad_view_factor="1", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, - **kwargs, + self, + geometry, + name=None, + thickness="0mm", + material="Al-Extruded", + htc="0w_per_m2kel", + ref_temperature="AmbientTemp", + ht_correlation=False, + ht_correlation_type="Natural Convection", + ht_correlation_fluid="air", + ht_correlation_flow_type="Turbulent", + ht_correlation_flow_direction="X", + ht_correlation_value_type="Average Values", + ht_correlation_free_stream_velocity="1m_per_sec", + ht_correlation_surface="Vertical", + ht_correlation_amb_temperature="AmbientTemp", + ext_surf_rad=False, + ext_surf_rad_material="Stainless-steel-cleaned", + ext_surf_rad_ref_temp="AmbientTemp", + ext_surf_rad_view_factor="1", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, + **kwargs ): """Assign a surface wall boundary condition with specified heat transfer coefficient. @@ -4094,14 +4115,14 @@ def _parse_variation_data(self, quantity, variation_type, variation_value, funct @pyaedt_function_handler() def assign_source( - self, - assignment, - thermal_condition, - assignment_value, - boundary_name=None, - radiate=False, - voltage_current_choice=False, - voltage_current_value=None, + self, + assignment, + thermal_condition, + assignment_value, + boundary_name=None, + radiate=False, + voltage_current_choice=False, + voltage_current_value=None, ): """Create a source power for a face. @@ -4326,7 +4347,7 @@ def create_resistor_network_from_matrix(self, sources_power, faces_ids, matrix, @pyaedt_function_handler def assign_solid_block( - self, object_name, power_assignment, boundary_name=None, htc=None, ext_temperature="AmbientTemp" + self, object_name, power_assignment, boundary_name=None, htc=None, ext_temperature="AmbientTemp" ): """ Assign block boundary for solid objects. @@ -4443,7 +4464,7 @@ def assign_solid_block( @pyaedt_function_handler def assign_hollow_block( - self, object_name, assignment_type, assignment_value, boundary_name=None, external_temperature="AmbientTemp" + self, object_name, assignment_type, assignment_value, boundary_name=None, external_temperature="AmbientTemp" ): """Assign block boundary for hollow objects. @@ -4608,18 +4629,18 @@ def get_fans_operating_point(self, export_file=None, setup_name=None, time_step= @pyaedt_function_handler() def assign_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - flow_type="Pressure", - pressure="AmbientPressure", - no_reverse_flow=False, - velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], - mass_flow_rate="0kg_per_s", - inflow=True, - direction_vector=None, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + flow_type="Pressure", + pressure="AmbientPressure", + no_reverse_flow=False, + velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], + mass_flow_rate="0kg_per_s", + inflow=True, + direction_vector=None, ): """ Assign free opening boundary condition. @@ -4700,9 +4721,8 @@ def assign_free_opening( mass_flow_rate = str(mass_flow_rate) + "kg_per_s" if not isinstance(temperature, str) and not isinstance(temperature, (dict, BoundaryDictionary)): temperature = str(temperature) + "cel" - if not isinstance(radiation_temperature, str) and not isinstance( - radiation_temperature, (dict, BoundaryDictionary) - ): + if not isinstance(radiation_temperature, str) and not isinstance(radiation_temperature, (dict, + BoundaryDictionary)): radiation_temperature = str(radiation_temperature) + "cel" if not isinstance(pressure, str) and not isinstance(pressure, (dict, BoundaryDictionary)): pressure = str(pressure) + "pascal" @@ -4774,13 +4794,13 @@ def assign_free_opening( @pyaedt_function_handler() def assign_pressure_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - no_reverse_flow=False, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + no_reverse_flow=False, ): """ Assign free opening boundary condition. @@ -4842,13 +4862,13 @@ def assign_pressure_free_opening( @pyaedt_function_handler() def assign_velocity_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], ): """ Assign free opening boundary condition. @@ -4915,15 +4935,15 @@ def assign_velocity_free_opening( @pyaedt_function_handler() def assign_mass_flow_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - mass_flow_rate="0kg_per_s", - inflow=True, - direction_vector=None, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + mass_flow_rate="0kg_per_s", + inflow=True, + direction_vector=None, ): """ Assign free opening boundary condition. @@ -5111,26 +5131,13 @@ def assign_adiabatic_plate(self, assignment, high_radiation_dict=None, low_radia return None @pyaedt_function_handler() - def assign_resistance( - self, - objects, - boundary_name=None, - total_power="0W", - fluid="air", - laminar=False, - loss_type="Device", - linear_loss=["1m_per_sec", "1m_per_sec", "1m_per_sec"], - quadratic_loss=[1, 1, 1], - linear_loss_free_area_ratio=[1, 1, 1], - quadratic_loss_free_area_ratio=[1, 1, 1], - power_law_constant=1, - power_law_exponent=1, - loss_curves_x=[[0, 1], [0, 1]], - loss_curves_y=[[0, 1], [0, 1]], - loss_curves_z=[[0, 1], [0, 1]], - loss_curve_flow_unit="m_per_sec", - loss_curve_pressure_unit="n_per_meter_sq", - ): + def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, + loss_type="Device", linear_loss = ["1m_per_sec", "1m_per_sec", "1m_per_sec"], + quadratic_loss = [1, 1, 1], linear_loss_free_area_ratio = [1, 1, 1], + quadratic_loss_free_area_ratio = [1, 1, 1], power_law_constant=1, power_law_exponent=1, + loss_curves_x = [[0, 1], [0, 1]], loss_curves_y = [[0, 1], [0, 1]], + loss_curves_z = [[0, 1], [0, 1]], loss_curve_flow_unit = "m_per_sec", + loss_curve_pressure_unit = "n_per_meter_sq"): """ Assign resistance boundary condition. @@ -5220,38 +5227,28 @@ def assign_resistance( Examples -------- """ - props = { - "Objects": objects if isinstance(objects, list) else [objects], - "Fluid Material": fluid, - "Laminar Flow": laminar, - } + props = {"Objects": objects if isinstance(objects, list) else [objects], "Fluid Material": fluid, + "Laminar Flow": laminar} if loss_type == "Device": - for direction, linear, quadratic, linear_far, quadratic_far in zip( - ["X", "Y", "Z"], - linear_loss, - quadratic_loss, - linear_loss_free_area_ratio, - quadratic_loss_free_area_ratio, - ): - props.update( - { - "Linear " - + direction - + " Coefficient": str(linear) + "m_per_sec" if not isinstance(linear, str) else str(linear), - "Quadratic " + direction + " Coefficient": str(quadratic), - "Linear " + direction + " Free Area Ratio": str(linear_far), - "Quadratic " + direction + " Free Area Ratio": str(quadratic_far), - } - ) + for direction, linear, quadratic, linear_far, quadratic_far in zip(["X", "Y", "Z"], linear_loss, + quadratic_loss, + linear_loss_free_area_ratio, + quadratic_loss_free_area_ratio): + props.update({ + "Linear " + direction + " Coefficient": str(linear) + "m_per_sec" if not isinstance(linear, + str) else str( + linear), + "Quadratic " + direction + " Coefficient": str(quadratic), + "Linear " + direction + " Free Area Ratio": str(linear_far), + "Quadratic " + direction + " Free Area Ratio": str(quadratic_far) + }) elif loss_type == "Power Law": - props.update( - { - "Pressure Loss Model": "Power Law", - "Power Law Coefficient": power_law_constant, - "Power Law Exponent": power_law_exponent, - } - ) + props.update({ + "Pressure Loss Model": "Power Law", + "Power Law Coefficient": power_law_constant, + "Power Law Exponent": power_law_exponent + }) elif loss_type == "Loss Curve": props.update({"Pressure Loss Model": "Loss Curve"}) for direction, values in zip(["X", "Y", "Z"], [loss_curves_x, loss_curves_y, loss_curves_z]): @@ -5259,7 +5256,7 @@ def assign_resistance( props[key] = { "DimUnits": [loss_curve_flow_unit, loss_curve_pressure_unit], "X": [str(i) for i in values[0]], - "Y": [str(i) for i in values[1]], + "Y": [str(i) for i in values[1]] } if isinstance(total_power, (dict, BoundaryDictionary)): @@ -5290,16 +5287,8 @@ def assign_resistance( return None @pyaedt_function_handler() - def assign_power_law_resistance( - self, - objects, - boundary_name=None, - total_power="0W", - fluid="air", - laminar=False, - power_law_constant=1, - power_law_exponent=1, - ): + def assign_power_law_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, + power_law_constant=1, power_law_exponent=1): """ Assign resistance boundary condition prescribing a power law. @@ -5345,31 +5334,16 @@ def assign_power_law_resistance( Examples -------- """ - return self.assign_resistance( - objects, - boundary_name=boundary_name, - total_power=total_power, - fluid=fluid, - laminar=laminar, - loss_type="Power Law", - power_law_constant=power_law_constant, - power_law_exponent=power_law_exponent, - ) + return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, + laminar=laminar, loss_type="Power Law", + power_law_constant=power_law_constant, power_law_exponent=power_law_exponent) @pyaedt_function_handler() - def assign_loss_curve_resistance( - self, - objects, - boundary_name=None, - total_power="0W", - fluid="air", - laminar=False, - loss_curves_x=[[0, 1], [0, 1]], - loss_curves_y=[[0, 1], [0, 1]], - loss_curves_z=[[0, 1], [0, 1]], - loss_curve_flow_unit="m_per_sec", - loss_curve_pressure_unit="n_per_meter_sq", - ): + def assign_loss_curve_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, + loss_curves_x = [[0, 1], [0, 1]], + loss_curves_y = [[0, 1], [0, 1]], loss_curves_z = [[0, 1], [0, 1]], + loss_curve_flow_unit="m_per_sec", + loss_curve_pressure_unit="n_per_meter_sq"): """ Assign resistance boundary condition prescribing a loss curve. @@ -5433,33 +5407,16 @@ def assign_loss_curve_resistance( Examples -------- """ - return self.assign_resistance( - objects, - boundary_name=boundary_name, - total_power=total_power, - fluid=fluid, - laminar=laminar, - loss_type="Loss Curve", - loss_curves_x=loss_curves_x, - loss_curves_y=loss_curves_y, - loss_curves_z=loss_curves_z, - loss_curve_flow_unit=loss_curve_flow_unit, - loss_curve_pressure_unit=loss_curve_pressure_unit, - ) + return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, + laminar=laminar, loss_type="Loss Curve", loss_curves_x=loss_curves_x, + loss_curves_y=loss_curves_y, loss_curves_z=loss_curves_z, + loss_curve_flow_unit=loss_curve_flow_unit, + loss_curve_pressure_unit=loss_curve_pressure_unit) @pyaedt_function_handler() - def assign_device_resistance( - self, - objects, - boundary_name=None, - total_power="0W", - fluid="air", - laminar=False, - linear_loss=["1m_per_sec", "1m_per_sec", "1m_per_sec"], - quadratic_loss=[1, 1, 1], - linear_loss_free_area_ratio=[1, 1, 1], - quadratic_loss_free_area_ratio=[1, 1, 1], - ): + def assign_device_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, + linear_loss = ["1m_per_sec", "1m_per_sec", "1m_per_sec"], quadratic_loss = [1, 1, 1], + linear_loss_free_area_ratio = [1, 1, 1], quadratic_loss_free_area_ratio = [1, 1, 1]): """ Assign resistance boundary condition using the device/approach model. @@ -5517,34 +5474,17 @@ def assign_device_resistance( Examples -------- """ - return self.assign_resistance( - objects, - boundary_name=boundary_name, - total_power=total_power, - fluid=fluid, - laminar=laminar, - loss_type="Device", - linear_loss=linear_loss, - quadratic_loss=quadratic_loss, - linear_loss_free_area_ratio=linear_loss_free_area_ratio, - quadratic_loss_free_area_ratio=quadratic_loss_free_area_ratio, - ) + return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, + laminar=laminar, loss_type="Device", linear_loss=linear_loss, + quadratic_loss=quadratic_loss, + linear_loss_free_area_ratio = linear_loss_free_area_ratio, + quadratic_loss_free_area_ratio = quadratic_loss_free_area_ratio) @pyaedt_function_handler() - def assign_recirculation_opening( - self, - face_list, - extract_face, - thermal_specification="Temperature", - assignment_value="0cel", - conductance_external_temperature=None, - flow_specification="Mass Flow", - flow_assignment="0kg_per_s_m2", - flow_direction=None, - start_time=None, - end_time=None, - boundary_name=None, - ): + def assign_recirculation_opening(self, face_list, extract_face, thermal_specification="Temperature", + assignment_value="0cel", conductance_external_temperature=None, + flow_specification="Mass Flow", flow_assignment="0kg_per_s_m2", + flow_direction=None, start_time=None, end_time=None, boundary_name=None): """Assign recirculation faces. Parameters @@ -5615,23 +5555,25 @@ def assign_recirculation_opening( return False if conductance_external_temperature is not None and thermal_specification != "Conductance": self.logger.warning( - "``conductance_external_temperature`` does not have any effect unless the ``thermal_specification`` " - 'is ``"Conductance"``.' - ) + '``conductance_external_temperature`` does not have any effect unless the ``thermal_specification`` ' + 'is ``"Conductance"``.') if conductance_external_temperature is not None and thermal_specification != "Conductance": self.logger.warning( - "``conductance_external_temperature`` must be specified when ``thermal_specification`` " - 'is ``"Conductance"``. Setting ``conductance_external_temperature`` to ``"AmbientTemp"``.' - ) + '``conductance_external_temperature`` must be specified when ``thermal_specification`` ' + 'is ``"Conductance"``. Setting ``conductance_external_temperature`` to ``"AmbientTemp"``.') if (start_time is not None or end_time is not None) and not self.solution_type == "Transient": - self.logger.warning("``start_time`` and ``end_time`` only effect steady-state simulations.") + self.logger.warning( + '``start_time`` and ``end_time`` only effect steady-state simulations.') elif self.solution_type == "Transient" and not (start_time is not None and end_time is not None): self.logger.warning( - '``start_time`` and ``end_time`` should be declared for transient simulations. Setting them to "0s".' - ) + '``start_time`` and ``end_time`` should be declared for transient simulations. Setting them to "0s".') start_time = "0s" end_time = "0s" - assignment_dict = {"Conductance": "Conductance", "Heat Input": "Heat Flow", "Temperature": "Temperature Change"} + assignment_dict = { + "Conductance": "Conductance", + "Heat Input": "Heat Flow", + "Temperature": "Temperature Change" + } props = {} if not isinstance(face_list[0], int): face_list = [f.id for f in face_list] @@ -5692,19 +5634,9 @@ def assign_recirculation_opening( return _create_boundary(bound) @pyaedt_function_handler() - def assign_blower_type1( - self, - faces, - inlet_face, - fan_curve_pressure, - fan_curve_flow, - blower_power="0W", - blade_rpm=0, - blade_angle="0rad", - fan_curve_pressure_unit="n_per_meter_sq", - fan_curve_flow_unit="m3_per_s", - boundary_name=None, - ): + def assign_blower_type1(self, faces, inlet_face, fan_curve_pressure, fan_curve_flow, blower_power="0W", blade_rpm=0, + blade_angle="0rad", fan_curve_pressure_unit="n_per_meter_sq", + fan_curve_flow_unit="m3_per_s", boundary_name=None): """Assign blower type 1. Parameters @@ -5765,31 +5697,13 @@ def assign_blower_type1( props["Blade RPM"] = blade_rpm props["Fan Blade Angle"] = blade_angle props["Blower Type"] = "Type 1" - return self._assign_blower( - props, - faces, - inlet_face, - fan_curve_flow_unit, - fan_curve_pressure_unit, - fan_curve_flow, - fan_curve_pressure, - blower_power, - boundary_name, - ) + return self._assign_blower(props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, + fan_curve_flow, fan_curve_pressure, blower_power, boundary_name) @pyaedt_function_handler() - def assign_blower_type2( - self, - faces, - inlet_face, - fan_curve_pressure, - fan_curve_flow, - blower_power="0W", - exhaust_angle="0rad", - fan_curve_pressure_unit="n_per_meter_sq", - fan_curve_flow_unit="m3_per_s", - boundary_name=None, - ): + def assign_blower_type2(self, faces, inlet_face, fan_curve_pressure, fan_curve_flow, blower_power="0W", + exhaust_angle="0rad", fan_curve_pressure_unit="n_per_meter_sq", + fan_curve_flow_unit="m3_per_s", boundary_name=None): """Assign blower type 2. Parameters @@ -5845,31 +5759,12 @@ def assign_blower_type2( props = {} props["Exhaust Exit Angle"] = exhaust_angle props["Blower Type"] = "Type 2" - return self._assign_blower( - props, - faces, - inlet_face, - fan_curve_flow_unit, - fan_curve_pressure_unit, - fan_curve_flow, - fan_curve_pressure, - blower_power, - boundary_name, - ) + return self._assign_blower(props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, + fan_curve_flow, fan_curve_pressure, blower_power, boundary_name) @pyaedt_function_handler() - def _assign_blower( - self, - props, - faces, - inlet_face, - fan_curve_flow_unit, - fan_curve_pressure_unit, - fan_curve_flow, - fan_curve_pressure, - blower_power, - boundary_name, - ): + def _assign_blower(self, props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, fan_curve_flow, + fan_curve_pressure, blower_power, boundary_name): if isinstance(faces[0], int): props["Faces"] = faces else: @@ -5891,21 +5786,11 @@ def _assign_blower( return _create_boundary(bound) @pyaedt_function_handler() - def assign_conducting_plate( - self, - obj_plate, - boundary_name=None, - total_power="0W", - thermal_specification="Thickness", - thickness="1mm", - solid_material="Al-Extruded", - conductance="0W_per_Cel", - shell_conduction=False, - thermal_resistance="0Kel_per_W", - low_side_rad_material=None, - high_side_rad_material=None, - thermal_impedance="0celm2_per_W", - ): + def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W", + thermal_specification="Thickness", thickness="1mm", solid_material="Al-Extruded", + conductance="0W_per_Cel", shell_conduction=False, thermal_resistance="0Kel_per_W", + low_side_rad_material=None, high_side_rad_material=None, + thermal_impedance="0celm2_per_W"): """ Assign thermal boundary conditions to a conducting plate. @@ -5982,9 +5867,9 @@ def assign_conducting_plate( props["Total Power"] = total_power props["Thermal Specification"] = thermal_specification for value, key, unit in zip( - [thickness, conductance, thermal_resistance, thermal_impedance], - ["Thickness", "Conductance", "Thermal Resistance", "Thermal Impedance"], - ["mm", "W_per_Cel", "Kel_per_W", "Cel_m2_per_W"], + [thickness, conductance, thermal_resistance, thermal_impedance], + ["Thickness", "Conductance", "Thermal Resistance", "Thermal Impedance"], + ["mm", "W_per_Cel", "Kel_per_W", "Cel_m2_per_W"] ): if thermal_specification == key: if not isinstance(value, str): @@ -5995,32 +5880,25 @@ def assign_conducting_plate( if low_side_rad_material is not None: props["LowSide"] = {"Radiate": False} else: - props["LowSide"] = {"Radiate": True, "RadiateTo": "AllObjects", "Surface Material": low_side_rad_material} + props["LowSide"] = {"Radiate": True, + "RadiateTo": "AllObjects", + "Surface Material": low_side_rad_material} if high_side_rad_material is not None: props["LowSide"] = {"Radiate": False} else: - props["HighSide"] = { - "Radiate": True, - "RadiateTo - High": "AllObjects - High", - "Surface Material - High": high_side_rad_material, - } + props["HighSide"] = {"Radiate": True, + "RadiateTo - High": "AllObjects - High", + "Surface Material - High": high_side_rad_material} props["Shell Conduction"] = shell_conduction if not boundary_name: boundary_name = generate_unique_name("Plate") bound = BoundaryObject(self, boundary_name, props, "Conducting Plate") return _create_boundary(bound) - def assign_conducting_plate_with_thickness( - self, - obj_plate, - boundary_name=None, - total_power="0W", - thickness="1mm", - solid_material="Al-Extruded", - shell_conduction=False, - low_side_rad_material=None, - high_side_rad_material=None, - ): + def assign_conducting_plate_with_thickness(self, obj_plate, boundary_name=None, total_power="0W", + thickness="1mm", solid_material="Al-Extruded", + shell_conduction=False, low_side_rad_material=None, + high_side_rad_material=None): """ Assign thermal boundary conditions with thickness specification to a conducting plate. @@ -6059,28 +5937,20 @@ def assign_conducting_plate_with_thickness( Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate( - obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thickness", - thickness=thickness, - solid_material=solid_material, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material, - ) - - def assign_conducting_plate_with_resistance( - self, - obj_plate, - boundary_name=None, - total_power="0W", - thermal_resistance="0Kel_per_W", - shell_conduction=False, - low_side_rad_material=None, - high_side_rad_material=None, - ): + return self.assign_conducting_plate(obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thickness", + thickness=thickness, + solid_material=solid_material, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material) + + def assign_conducting_plate_with_resistance(self, obj_plate, boundary_name=None, total_power="0W", + thermal_resistance="0Kel_per_W", + shell_conduction=False, low_side_rad_material=None, + high_side_rad_material=None): """ Assign thermal boundary conditions with thermal resistance specification to a conducting plate. @@ -6116,27 +5986,19 @@ def assign_conducting_plate_with_resistance( Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate( - obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thermal Resistance", - thermal_resistance=thermal_resistance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material, - ) - - def assign_conducting_plate_with_impedance( - self, - obj_plate, - boundary_name=None, - total_power="0W", - thermal_impedance="0celm2_per_W", - shell_conduction=False, - low_side_rad_material=None, - high_side_rad_material=None, - ): + return self.assign_conducting_plate(obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thermal Resistance", + thermal_resistance=thermal_resistance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material) + + def assign_conducting_plate_with_impedance(self, obj_plate, boundary_name=None, total_power="0W", + thermal_impedance="0celm2_per_W", + shell_conduction=False, low_side_rad_material=None, + high_side_rad_material=None): """ Assign thermal boundary conditions with thermal impedance specification to a conducting plate. @@ -6172,27 +6034,19 @@ def assign_conducting_plate_with_impedance( Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate( - obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thermal Impedance", - thermal_impedance=thermal_impedance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material, - ) - - def assign_conducting_plate_with_conductance( - self, - obj_plate, - boundary_name=None, - total_power="0W", - conductance="0W_per_Cel", - shell_conduction=False, - low_side_rad_material=None, - high_side_rad_material=None, - ): + return self.assign_conducting_plate(obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thermal Impedance", + thermal_impedance=thermal_impedance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material) + + def assign_conducting_plate_with_conductance(self, obj_plate, boundary_name=None, total_power="0W", + conductance="0W_per_Cel", + shell_conduction=False, low_side_rad_material=None, + high_side_rad_material=None): """ Assign thermal boundary conditions with conductance specification to a conducting plate. @@ -6228,16 +6082,14 @@ def assign_conducting_plate_with_conductance( Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate( - obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Conductance", - conductance=conductance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material, - ) + return self.assign_conducting_plate(obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Conductance", + conductance=conductance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material) @pyaedt_function_handler def __create_dataset_assignment(self, type_assignment, ds_name, scale): From 5a0141c19724955462b0b40992ec85f1bf615d6a Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Tue, 23 Apr 2024 17:00:10 +0200 Subject: [PATCH 04/22] fix __repr__ --- pyaedt/application/Design.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index a234756cdbe..a761d35077a 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4052,10 +4052,11 @@ def available_properties(self): return [prop for prop in self.design_settings.GetPropNames() if not prop.endswith("/Choices")] def __repr__(self): - design_settings = {} + lines = ["{"] for prop in self.available_properties: - design_settings[prop] = self.design_settings.GetPropValue(prop) - return f"{design_settings}" + lines.append("\t{}: {}".format(prop, self.design_settings.GetPropValue(prop))) + lines.append("}") + return "\n".join(lines) def __setitem__(self, key, value): if key in self.available_properties: From 2881f4b1d0842a17210ab3bc5d95171cde41ef25 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Tue, 23 Apr 2024 17:06:19 +0200 Subject: [PATCH 05/22] fix for manipulate_design --- pyaedt/application/Design.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index a761d35077a..c4b76ebd762 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4022,7 +4022,7 @@ def set_temporary_directory(self, temp_dir_path): @pyaedt_function_handler() def _manipulate_design_settings_inputs(self, k, v): - pass + return v @property def design_settings(self): From 6f5f31eaf5b98b80bc06f0b400071129272f5749 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti <58366962+lorenzovecchietti@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:58:47 +0200 Subject: [PATCH 06/22] Update pyaedt/application/Design.py Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- pyaedt/application/Design.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index c4b76ebd762..ba54b952091 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4077,5 +4077,5 @@ def __getitem__(self, key): if key in self.available_properties: return self.design_settings.GetPropValue(key) else: - self._app.logger.error("{} property not available in design settings.".format(key)) + self._app.logger.error("{} property is not available in design settings.".format(key)) return None From 93825e188f41318aa9000fe6d6d7ddc44e5fc290 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti <58366962+lorenzovecchietti@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:58:59 +0200 Subject: [PATCH 07/22] Update pyaedt/application/Design.py Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- pyaedt/application/Design.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index ba54b952091..26fce18cf55 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4071,7 +4071,7 @@ def __setitem__(self, key, value): return False self.design_settings.SetPropValue(key, value) else: - self._app.logger.error("{} property not available in design settings.".format(key)) + self._app.logger.error("{} property is not available in design settings.".format(key)) def __getitem__(self, key): if key in self.available_properties: From 215dafd23f9ad86e0e63caa0c18369ffd3517481 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Wed, 24 Apr 2024 18:05:11 +0200 Subject: [PATCH 08/22] Fix docstring --- pyaedt/application/Design.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 26fce18cf55..313b0830a58 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4026,6 +4026,7 @@ def _manipulate_design_settings_inputs(self, k, v): @property def design_settings(self): + """Design settings for the AEDT app.""" return DesignSettings(self, self._manipulate_design_settings_inputs) From 7c44cff55075a46f87c0cfb7087b6bd9dde419b0 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Fri, 26 Apr 2024 20:25:24 +0200 Subject: [PATCH 09/22] Tests fixes --- _unittest/test_01_Design.py | 5 +- pyaedt/application/Design.py | 5 + pyaedt/icepak.py | 981 +++++++++++++++++++++-------------- pyaedt/maxwell.py | 2 +- 4 files changed, 588 insertions(+), 405 deletions(-) diff --git a/_unittest/test_01_Design.py b/_unittest/test_01_Design.py index 3cba663e92b..c1d1a1c7acd 100644 --- a/_unittest/test_01_Design.py +++ b/_unittest/test_01_Design.py @@ -10,6 +10,7 @@ from pyaedt import Hfss3dLayout from pyaedt import Icepak from pyaedt import get_pyaedt_app +from pyaedt.application.Design import DesignSettings from pyaedt.application.aedt_objects import AedtObjects from pyaedt.application.design_solutions import model_names from pyaedt.generic.general_methods import is_linux @@ -418,9 +419,9 @@ def test_39_load_project(self, desktop): def test_40_get_design_settings(self, add_app): ipk = add_app(application=Icepak) - design_settings_dict = ipk.design_settings() + design_settings_dict = ipk.design_settings - assert isinstance(design_settings_dict, dict) + assert isinstance(design_settings_dict, DesignSettings) assert "AmbTemp" in design_settings_dict assert "AmbRadTemp" in design_settings_dict assert "GravityVec" in design_settings_dict diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 313b0830a58..21480772395 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4080,3 +4080,8 @@ def __getitem__(self, key): else: self._app.logger.error("{} property is not available in design settings.".format(key)) return None + + def __contains__(self, item): + if item in self.available_properties: + return True + return False diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 3499f47c8b5..237f3d739d6 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1605,25 +1605,29 @@ def create_parametric_heatsink_on_face( hs.name = hs_name return hs, name_map - # fmt: off + @pyaedt_function_handler( + ambtemp="ambient_temperature", + performvalidation="perform_validation", + defaultfluid="default_fluid", + defaultsolid="default_solid", + ) @pyaedt_function_handler() def edit_design_settings( - self, - gravity_dir=0, - ambtemp=20, - performvalidation=False, - check_level="None", - defaultfluid="air", - defaultsolid="Al-Extruded", - export_monitor=False, - export_directory=os.getcwd(), - gauge_pressure=0, - radiation_temperature=20, - ignore_unclassified_objects=False, - skip_intersection_checks=False, - **kwargs + self, + gravity_dir=0, + ambient_temperature=20, + perform_validation=False, + check_level="None", + default_fluid="air", + default_solid="Al-Extruded", + default_surface="Steel-oxidised-surface", + export_monitor=False, + export_directory=os.getcwd(), + gauge_pressure=0, + radiation_temperature=20, + ignore_unclassified_objects=False, + skip_intersection_checks=False, ): - # fmt: on """Update the main settings of the design. Parameters @@ -1631,18 +1635,20 @@ def edit_design_settings( gravity_dir : int, optional Gravity direction from -X to +Z. Options are ``0`` to ``5``. The default is ``0``. - ambtemp : float, str, optional + ambient_temperature : float, str, optional Ambient temperature. The default is ``20``. The default unit is celsius for float or string including unit definition is accepted, e.g. ``325kel``. - performvalidation : bool, optional + perform_validation : bool, optional Whether to perform validation. The default is ``False``. check_level : str, optional Level of check to perform during validation. The default is ``"None"``. - defaultfluid : str, optional + default_fluid : str, optional Default fluid material. The default is ``"air"``. - defaultsolid : str, optional + default_solid : str, optional Default solid material. The default is ``"Al-Extruded"``. + default_surface : str, optional + Default surface material. The default is ``"Steel-oxidised-surface"``. export_monitor : bool, optional Whether to use the default export directory for monitor point data. The default value is ``False``. @@ -1672,11 +1678,11 @@ def edit_design_settings( """ # # Configure design settings for gravity etc - IceGravity = ["X", "Y", "Z"] - GVPos = False + ice_gravity = ["X", "Y", "Z"] + gv_pos = False if int(gravity_dir) > 2: - GVPos = True - GVA = IceGravity[int(gravity_dir) - 3] + gv_pos = True + gva = ice_gravity[int(gravity_dir) - 3] self._odesign.SetDesignSettings( [ "NAME:Design Settings Data", @@ -1687,9 +1693,9 @@ def edit_design_settings( "Default Solid Material:=", default_solid, "Default Surface Material:=", - "Steel-oxidised-surface", + default_surface, "AmbientTemperature:=", - self.value_with_units(ambtemp, "cel"), + self.value_with_units(ambient_temperature, "cel"), "AmbientPressure:=", self.value_with_units(gauge_pressure, "n_per_meter_sq"), "AmbientRadiationTemperature:=", @@ -1697,9 +1703,9 @@ def edit_design_settings( "Gravity Vector CS ID:=", 1, "Gravity Vector Axis:=", - GVA, + gva, "Positive:=", - GVPos, + gv_pos, "ExportOnSimulationComplete:=", export_monitor, "ExportDirectory:=", @@ -1717,21 +1723,19 @@ def edit_design_settings( ) return True - @pyaedt_function_handler(designname="design", - setupname="setup", - sweepname="sweep", - paramlist="parameters", - object_list="assignment") + @pyaedt_function_handler( + designname="design", setupname="setup", sweepname="sweep", paramlist="parameters", object_list="assignment" + ) def assign_em_losses( - self, - design="HFSSDesign1", - setup="Setup1", - sweep="LastAdaptive", - map_frequency=None, - surface_objects=None, - source_project_name=None, - parameters=None, - assignment=None, + self, + design="HFSSDesign1", + setup="Setup1", + sweep="LastAdaptive", + map_frequency=None, + surface_objects=None, + source_project_name=None, + parameters=None, + assignment=None, ): """Map EM losses to an Icepak design. @@ -1836,13 +1840,13 @@ def assign_em_losses( @pyaedt_function_handler() def eval_surface_quantity_from_field_summary( - self, - faces_list, - quantity_name="HeatTransCoeff", - savedir=None, - filename=None, - sweep_name=None, - parameter_dict_with_values={}, + self, + faces_list, + quantity_name="HeatTransCoeff", + savedir=None, + filename=None, + sweep_name=None, + parameter_dict_with_values={}, ): """Export the field surface output. @@ -1909,13 +1913,13 @@ def eval_surface_quantity_from_field_summary( return filename def eval_volume_quantity_from_field_summary( - self, - object_list, - quantity_name="HeatTransCoeff", - savedir=None, - filename=None, - sweep_name=None, - parameter_dict_with_values={}, + self, + object_list, + quantity_name="HeatTransCoeff", + savedir=None, + filename=None, + sweep_name=None, + parameter_dict_with_values={}, ): """Export the field volume output. @@ -1980,16 +1984,16 @@ def eval_volume_quantity_from_field_summary( return filename def export_summary( - self, - output_dir=None, - solution_name=None, - type="Object", - geometry_type="Volume", - quantity="Temperature", - variation="", - variation_list=None, - filename="IPKsummaryReport", - **kwargs + self, + output_dir=None, + solution_name=None, + type="Object", + geometry_type="Volume", + quantity="Temperature", + variation="", + variation_list=None, + filename="IPKsummaryReport", + **kwargs, ): """Export a fields summary of all objects. @@ -2026,16 +2030,16 @@ def export_summary( >>> oModule.EditFieldsSummarySetting >>> oModule.ExportFieldsSummary """ - if 'geometryType' in kwargs: - warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", - DeprecationWarning) + if "geometryType" in kwargs: + warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", DeprecationWarning) - if 'variationlist' in kwargs: - warnings.warn("The 'variationlist' argument is deprecated. Use 'variation_list' instead.", - DeprecationWarning) + if "variationlist" in kwargs: + warnings.warn( + "The 'variationlist' argument is deprecated. Use 'variation_list' instead.", DeprecationWarning + ) - geometry_type = kwargs.get('geometryType', geometry_type) - variation_list = kwargs.get('variationlist', variation_list) + geometry_type = kwargs.get("geometryType", geometry_type) + variation_list = kwargs.get("variationlist", variation_list) if variation_list is None: variation_list = [] @@ -2187,14 +2191,14 @@ def get_link_data(self, links_data, **kwargs): @pyaedt_function_handler() def create_fan( - self, - name=None, - is_2d=False, - shape="Circular", - cross_section="XY", - radius="0.008mm", - hub_radius="0mm", - origin=None, + self, + name=None, + is_2d=False, + shape="Circular", + cross_section="XY", + radius="0.008mm", + hub_radius="0mm", + origin=None, ): """Create a fan component in Icepak that is linked to an HFSS 3D Layout object. @@ -2288,7 +2292,7 @@ def create_fan( "MaterialDefinitionParameters": OrderedDict({"VariableOrders": OrderedDict()}), "MapInstanceParameters": "DesignVariable", "UniqueDefinitionIdentifier": "57c8ab4e-4db9-4881-b6bb-" - + random_string(12, char_set="abcdef0123456789"), + + random_string(12, char_set="abcdef0123456789"), "OriginFilePath": "", "IsLocal": False, "ChecksumString": "", @@ -2322,7 +2326,7 @@ def create_fan( @pyaedt_function_handler() def create_ipk_3dcomponent_pcb( - self, + self, compName, setupLinkInfo, solutionFreq, @@ -2476,7 +2480,7 @@ def create_ipk_3dcomponent_pcb( @pyaedt_function_handler() def create_pcb_from_3dlayout( - self, + self, component_name, project_name, design_name, @@ -2646,15 +2650,15 @@ def copyGroupFrom(self, group_name, source_design, source_project_name=None, sou @pyaedt_function_handler() def globalMeshSettings( - self, - meshtype, - gap_min_elements="1", - noOgrids=False, - MLM_en=True, - MLM_Type="3D", - stairStep_en=False, - edge_min_elements="1", - object="Region", + self, + meshtype, + gap_min_elements="1", + noOgrids=False, + MLM_en=True, + MLM_Type="3D", + stairStep_en=False, + edge_min_elements="1", + object="Region", ): """Create a custom mesh tailored on a PCB design. @@ -2743,7 +2747,7 @@ def globalMeshSettings( @pyaedt_function_handler() def create_meshregion_component( - self, scale_factor=1.0, name="Component_Region", restore_padding_values=[50, 50, 50, 50, 50, 50] + self, scale_factor=1.0, name="Component_Region", restore_padding_values=[50, 50, 50, 50, 50, 50] ): """Create a bounding box to use as a mesh region in Icepak. @@ -2890,14 +2894,14 @@ def get_gas_objects(self): @pyaedt_function_handler() def generate_fluent_mesh( - self, - object_lists=None, - meshtype="tetrahedral", - min_size=None, - max_size=None, - inflation_layer_number=3, - inflation_growth_rate=1.2, - mesh_growth_rate=1.2, + self, + object_lists=None, + meshtype="tetrahedral", + min_size=None, + max_size=None, + inflation_layer_number=3, + inflation_growth_rate=1.2, + mesh_growth_rate=1.2, ): """Generate a Fluent mesh for a list of selected objects and assign the mesh automatically to the objects. @@ -3056,13 +3060,13 @@ def generate_fluent_mesh( @pyaedt_function_handler() def apply_icepak_settings( - self, - ambienttemp=20, - gravityDir=5, - perform_minimal_val=True, - default_fluid="air", - default_solid="Al-Extruded", - default_surface="Steel-oxidised-surface", + self, + ambienttemp=20, + gravityDir=5, + perform_minimal_val=True, + default_fluid="air", + default_solid="Al-Extruded", + default_surface="Steel-oxidised-surface", ): """Apply Icepak default design settings. @@ -3190,31 +3194,31 @@ def assign_surface_material(self, obj, mat): @pyaedt_function_handler() def import_idf( - self, - board_path, - library_path=None, - control_path=None, - filter_cap=False, - filter_ind=False, - filter_res=False, - filter_height_under=None, - filter_height_exclude_2d=False, - power_under=None, - create_filtered_as_non_model=False, - high_surface_thick="0.07mm", - low_surface_thick="0.07mm", - internal_thick="0.07mm", - internal_layer_number=2, - high_surface_coverage=30, - low_surface_coverage=30, - internal_layer_coverage=30, - trace_material="Cu-Pure", - substrate_material="FR-4", - create_board=True, - model_board_as_rect=False, - model_device_as_rect=True, - cutoff_height="5mm", - component_lib="", + self, + board_path, + library_path=None, + control_path=None, + filter_cap=False, + filter_ind=False, + filter_res=False, + filter_height_under=None, + filter_height_exclude_2d=False, + power_under=None, + create_filtered_as_non_model=False, + high_surface_thick="0.07mm", + low_surface_thick="0.07mm", + internal_thick="0.07mm", + internal_layer_number=2, + high_surface_coverage=30, + low_surface_coverage=30, + internal_layer_coverage=30, + trace_material="Cu-Pure", + substrate_material="FR-4", + create_board=True, + model_board_as_rect=False, + model_device_as_rect=True, + cutoff_height="5mm", + component_lib="", ): """Import an IDF file into an Icepak design. @@ -3494,33 +3498,33 @@ def get_face_normal(obj_face): @pyaedt_function_handler() def assign_stationary_wall( - self, - geometry, - boundary_condition, - name=None, - temperature="0cel", - heat_flux="0irrad_W_per_m2", - thickness="0mm", - htc="0w_per_m2kel", - ref_temperature="AmbientTemp", - material="Al-Extruded", # relevant if th>0 - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", # relevant if radiate = False - ht_correlation=False, - ht_correlation_type="Natural Convection", - ht_correlation_fluid="air", - ht_correlation_flow_type="Turbulent", - ht_correlation_flow_direction="X", - ht_correlation_value_type="Average Values", # "Local Values" - ht_correlation_free_stream_velocity="1m_per_sec", - ht_correlation_surface="Vertical", # Top, Bottom, Vertical - ht_correlation_amb_temperature="AmbientTemp", - shell_conduction=False, - ext_surf_rad=False, - ext_surf_rad_material="Stainless-steel-cleaned", - ext_surf_rad_ref_temp="AmbientTemp", - ext_surf_rad_view_factor="1", - **kwargs + self, + geometry, + boundary_condition, + name=None, + temperature="0cel", + heat_flux="0irrad_W_per_m2", + thickness="0mm", + htc="0w_per_m2kel", + ref_temperature="AmbientTemp", + material="Al-Extruded", # relevant if th>0 + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", # relevant if radiate = False + ht_correlation=False, + ht_correlation_type="Natural Convection", + ht_correlation_fluid="air", + ht_correlation_flow_type="Turbulent", + ht_correlation_flow_direction="X", + ht_correlation_value_type="Average Values", # "Local Values" + ht_correlation_free_stream_velocity="1m_per_sec", + ht_correlation_surface="Vertical", # Top, Bottom, Vertical + ht_correlation_amb_temperature="AmbientTemp", + shell_conduction=False, + ext_surf_rad=False, + ext_surf_rad_material="Stainless-steel-cleaned", + ext_surf_rad_ref_temp="AmbientTemp", + ext_surf_rad_view_factor="1", + **kwargs, ): """Assign surface wall boundary condition. @@ -3670,18 +3674,22 @@ def assign_stationary_wall( props["Solid Material"] = material props["External Condition"] = boundary_condition if "htc_dataset" in kwargs: # backward compatibility - warnings.warn("``htc_dataset`` argument is being deprecated. Create a dictionary as per" - "documentation and assign it to the ``htc`` argument.", DeprecationWarning) + warnings.warn( + "``htc_dataset`` argument is being deprecated. Create a dictionary as per" + "documentation and assign it to the ``htc`` argument.", + DeprecationWarning, + ) if kwargs["htc_dataset"] is not None: - htc = {"Type": "Temp Dep", - "Function": "Piecewise Linear", - "Values": kwargs["htc_dataset"], - } + htc = { + "Type": "Temp Dep", + "Function": "Piecewise Linear", + "Values": kwargs["htc_dataset"], + } for quantity, assignment_value, to_add in [ ("External Radiation Reference Temperature", ext_surf_rad_ref_temp, ext_surf_rad), ("Heat Transfer Coefficient", htc, boundary_condition == "Heat Transfer Coefficient"), ("Temperature", temperature, boundary_condition == "Temperature"), - ("Heat Flux", heat_flux, boundary_condition == "Heat Flux") + ("Heat Flux", heat_flux, boundary_condition == "Heat Flux"), ]: if to_add: if isinstance(assignment_value, (dict, BoundaryDictionary)): @@ -3734,15 +3742,15 @@ def assign_stationary_wall( @pyaedt_function_handler() def assign_stationary_wall_with_heat_flux( - self, - geometry, - name=None, - heat_flux="0irrad_W_per_m2", - thickness="0mm", - material="Al-Extruded", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, + self, + geometry, + name=None, + heat_flux="0irrad_W_per_m2", + thickness="0mm", + material="Al-Extruded", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, ): """Assign a surface wall boundary condition with specified heat flux. @@ -3796,15 +3804,15 @@ def assign_stationary_wall_with_heat_flux( @pyaedt_function_handler() def assign_stationary_wall_with_temperature( - self, - geometry, - name=None, - temperature="0cel", - thickness="0mm", - material="Al-Extruded", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, + self, + geometry, + name=None, + temperature="0cel", + thickness="0mm", + material="Al-Extruded", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, ): """Assign a surface wall boundary condition with specified temperature. @@ -3859,30 +3867,30 @@ def assign_stationary_wall_with_temperature( @pyaedt_function_handler() def assign_stationary_wall_with_htc( - self, - geometry, - name=None, - thickness="0mm", - material="Al-Extruded", - htc="0w_per_m2kel", - ref_temperature="AmbientTemp", - ht_correlation=False, - ht_correlation_type="Natural Convection", - ht_correlation_fluid="air", - ht_correlation_flow_type="Turbulent", - ht_correlation_flow_direction="X", - ht_correlation_value_type="Average Values", - ht_correlation_free_stream_velocity="1m_per_sec", - ht_correlation_surface="Vertical", - ht_correlation_amb_temperature="AmbientTemp", - ext_surf_rad=False, - ext_surf_rad_material="Stainless-steel-cleaned", - ext_surf_rad_ref_temp="AmbientTemp", - ext_surf_rad_view_factor="1", - radiate=False, - radiate_surf_mat="Steel-oxidised-surface", - shell_conduction=False, - **kwargs + self, + geometry, + name=None, + thickness="0mm", + material="Al-Extruded", + htc="0w_per_m2kel", + ref_temperature="AmbientTemp", + ht_correlation=False, + ht_correlation_type="Natural Convection", + ht_correlation_fluid="air", + ht_correlation_flow_type="Turbulent", + ht_correlation_flow_direction="X", + ht_correlation_value_type="Average Values", + ht_correlation_free_stream_velocity="1m_per_sec", + ht_correlation_surface="Vertical", + ht_correlation_amb_temperature="AmbientTemp", + ext_surf_rad=False, + ext_surf_rad_material="Stainless-steel-cleaned", + ext_surf_rad_ref_temp="AmbientTemp", + ext_surf_rad_view_factor="1", + radiate=False, + radiate_surf_mat="Steel-oxidised-surface", + shell_conduction=False, + **kwargs, ): """Assign a surface wall boundary condition with specified heat transfer coefficient. @@ -4115,14 +4123,14 @@ def _parse_variation_data(self, quantity, variation_type, variation_value, funct @pyaedt_function_handler() def assign_source( - self, - assignment, - thermal_condition, - assignment_value, - boundary_name=None, - radiate=False, - voltage_current_choice=False, - voltage_current_value=None, + self, + assignment, + thermal_condition, + assignment_value, + boundary_name=None, + radiate=False, + voltage_current_choice=False, + voltage_current_value=None, ): """Create a source power for a face. @@ -4347,7 +4355,7 @@ def create_resistor_network_from_matrix(self, sources_power, faces_ids, matrix, @pyaedt_function_handler def assign_solid_block( - self, object_name, power_assignment, boundary_name=None, htc=None, ext_temperature="AmbientTemp" + self, object_name, power_assignment, boundary_name=None, htc=None, ext_temperature="AmbientTemp" ): """ Assign block boundary for solid objects. @@ -4464,7 +4472,7 @@ def assign_solid_block( @pyaedt_function_handler def assign_hollow_block( - self, object_name, assignment_type, assignment_value, boundary_name=None, external_temperature="AmbientTemp" + self, object_name, assignment_type, assignment_value, boundary_name=None, external_temperature="AmbientTemp" ): """Assign block boundary for hollow objects. @@ -4629,18 +4637,18 @@ def get_fans_operating_point(self, export_file=None, setup_name=None, time_step= @pyaedt_function_handler() def assign_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - flow_type="Pressure", - pressure="AmbientPressure", - no_reverse_flow=False, - velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], - mass_flow_rate="0kg_per_s", - inflow=True, - direction_vector=None, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + flow_type="Pressure", + pressure="AmbientPressure", + no_reverse_flow=False, + velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], + mass_flow_rate="0kg_per_s", + inflow=True, + direction_vector=None, ): """ Assign free opening boundary condition. @@ -4721,8 +4729,9 @@ def assign_free_opening( mass_flow_rate = str(mass_flow_rate) + "kg_per_s" if not isinstance(temperature, str) and not isinstance(temperature, (dict, BoundaryDictionary)): temperature = str(temperature) + "cel" - if not isinstance(radiation_temperature, str) and not isinstance(radiation_temperature, (dict, - BoundaryDictionary)): + if not isinstance(radiation_temperature, str) and not isinstance( + radiation_temperature, (dict, BoundaryDictionary) + ): radiation_temperature = str(radiation_temperature) + "cel" if not isinstance(pressure, str) and not isinstance(pressure, (dict, BoundaryDictionary)): pressure = str(pressure) + "pascal" @@ -4794,13 +4803,13 @@ def assign_free_opening( @pyaedt_function_handler() def assign_pressure_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - no_reverse_flow=False, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + no_reverse_flow=False, ): """ Assign free opening boundary condition. @@ -4862,13 +4871,13 @@ def assign_pressure_free_opening( @pyaedt_function_handler() def assign_velocity_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + velocity=["0m_per_sec", "0m_per_sec", "0m_per_sec"], ): """ Assign free opening boundary condition. @@ -4935,15 +4944,15 @@ def assign_velocity_free_opening( @pyaedt_function_handler() def assign_mass_flow_free_opening( - self, - assignment, - boundary_name=None, - temperature="AmbientTemp", - radiation_temperature="AmbientRadTemp", - pressure="AmbientPressure", - mass_flow_rate="0kg_per_s", - inflow=True, - direction_vector=None, + self, + assignment, + boundary_name=None, + temperature="AmbientTemp", + radiation_temperature="AmbientRadTemp", + pressure="AmbientPressure", + mass_flow_rate="0kg_per_s", + inflow=True, + direction_vector=None, ): """ Assign free opening boundary condition. @@ -5131,13 +5140,26 @@ def assign_adiabatic_plate(self, assignment, high_radiation_dict=None, low_radia return None @pyaedt_function_handler() - def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - loss_type="Device", linear_loss = ["1m_per_sec", "1m_per_sec", "1m_per_sec"], - quadratic_loss = [1, 1, 1], linear_loss_free_area_ratio = [1, 1, 1], - quadratic_loss_free_area_ratio = [1, 1, 1], power_law_constant=1, power_law_exponent=1, - loss_curves_x = [[0, 1], [0, 1]], loss_curves_y = [[0, 1], [0, 1]], - loss_curves_z = [[0, 1], [0, 1]], loss_curve_flow_unit = "m_per_sec", - loss_curve_pressure_unit = "n_per_meter_sq"): + def assign_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + loss_type="Device", + linear_loss=["1m_per_sec", "1m_per_sec", "1m_per_sec"], + quadratic_loss=[1, 1, 1], + linear_loss_free_area_ratio=[1, 1, 1], + quadratic_loss_free_area_ratio=[1, 1, 1], + power_law_constant=1, + power_law_exponent=1, + loss_curves_x=[[0, 1], [0, 1]], + loss_curves_y=[[0, 1], [0, 1]], + loss_curves_z=[[0, 1], [0, 1]], + loss_curve_flow_unit="m_per_sec", + loss_curve_pressure_unit="n_per_meter_sq", + ): """ Assign resistance boundary condition. @@ -5227,28 +5249,38 @@ def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid Examples -------- """ - props = {"Objects": objects if isinstance(objects, list) else [objects], "Fluid Material": fluid, - "Laminar Flow": laminar} + props = { + "Objects": objects if isinstance(objects, list) else [objects], + "Fluid Material": fluid, + "Laminar Flow": laminar, + } if loss_type == "Device": - for direction, linear, quadratic, linear_far, quadratic_far in zip(["X", "Y", "Z"], linear_loss, - quadratic_loss, - linear_loss_free_area_ratio, - quadratic_loss_free_area_ratio): - props.update({ - "Linear " + direction + " Coefficient": str(linear) + "m_per_sec" if not isinstance(linear, - str) else str( - linear), - "Quadratic " + direction + " Coefficient": str(quadratic), - "Linear " + direction + " Free Area Ratio": str(linear_far), - "Quadratic " + direction + " Free Area Ratio": str(quadratic_far) - }) + for direction, linear, quadratic, linear_far, quadratic_far in zip( + ["X", "Y", "Z"], + linear_loss, + quadratic_loss, + linear_loss_free_area_ratio, + quadratic_loss_free_area_ratio, + ): + props.update( + { + "Linear " + + direction + + " Coefficient": str(linear) + "m_per_sec" if not isinstance(linear, str) else str(linear), + "Quadratic " + direction + " Coefficient": str(quadratic), + "Linear " + direction + " Free Area Ratio": str(linear_far), + "Quadratic " + direction + " Free Area Ratio": str(quadratic_far), + } + ) elif loss_type == "Power Law": - props.update({ - "Pressure Loss Model": "Power Law", - "Power Law Coefficient": power_law_constant, - "Power Law Exponent": power_law_exponent - }) + props.update( + { + "Pressure Loss Model": "Power Law", + "Power Law Coefficient": power_law_constant, + "Power Law Exponent": power_law_exponent, + } + ) elif loss_type == "Loss Curve": props.update({"Pressure Loss Model": "Loss Curve"}) for direction, values in zip(["X", "Y", "Z"], [loss_curves_x, loss_curves_y, loss_curves_z]): @@ -5256,7 +5288,7 @@ def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid props[key] = { "DimUnits": [loss_curve_flow_unit, loss_curve_pressure_unit], "X": [str(i) for i in values[0]], - "Y": [str(i) for i in values[1]] + "Y": [str(i) for i in values[1]], } if isinstance(total_power, (dict, BoundaryDictionary)): @@ -5287,8 +5319,16 @@ def assign_resistance(self, objects, boundary_name=None, total_power="0W", fluid return None @pyaedt_function_handler() - def assign_power_law_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - power_law_constant=1, power_law_exponent=1): + def assign_power_law_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + power_law_constant=1, + power_law_exponent=1, + ): """ Assign resistance boundary condition prescribing a power law. @@ -5334,16 +5374,31 @@ def assign_power_law_resistance(self, objects, boundary_name=None, total_power=" Examples -------- """ - return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, - laminar=laminar, loss_type="Power Law", - power_law_constant=power_law_constant, power_law_exponent=power_law_exponent) + return self.assign_resistance( + objects, + boundary_name=boundary_name, + total_power=total_power, + fluid=fluid, + laminar=laminar, + loss_type="Power Law", + power_law_constant=power_law_constant, + power_law_exponent=power_law_exponent, + ) @pyaedt_function_handler() - def assign_loss_curve_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - loss_curves_x = [[0, 1], [0, 1]], - loss_curves_y = [[0, 1], [0, 1]], loss_curves_z = [[0, 1], [0, 1]], - loss_curve_flow_unit="m_per_sec", - loss_curve_pressure_unit="n_per_meter_sq"): + def assign_loss_curve_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + loss_curves_x=[[0, 1], [0, 1]], + loss_curves_y=[[0, 1], [0, 1]], + loss_curves_z=[[0, 1], [0, 1]], + loss_curve_flow_unit="m_per_sec", + loss_curve_pressure_unit="n_per_meter_sq", + ): """ Assign resistance boundary condition prescribing a loss curve. @@ -5407,16 +5462,33 @@ def assign_loss_curve_resistance(self, objects, boundary_name=None, total_power= Examples -------- """ - return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, - laminar=laminar, loss_type="Loss Curve", loss_curves_x=loss_curves_x, - loss_curves_y=loss_curves_y, loss_curves_z=loss_curves_z, - loss_curve_flow_unit=loss_curve_flow_unit, - loss_curve_pressure_unit=loss_curve_pressure_unit) + return self.assign_resistance( + objects, + boundary_name=boundary_name, + total_power=total_power, + fluid=fluid, + laminar=laminar, + loss_type="Loss Curve", + loss_curves_x=loss_curves_x, + loss_curves_y=loss_curves_y, + loss_curves_z=loss_curves_z, + loss_curve_flow_unit=loss_curve_flow_unit, + loss_curve_pressure_unit=loss_curve_pressure_unit, + ) @pyaedt_function_handler() - def assign_device_resistance(self, objects, boundary_name=None, total_power="0W", fluid="air", laminar=False, - linear_loss = ["1m_per_sec", "1m_per_sec", "1m_per_sec"], quadratic_loss = [1, 1, 1], - linear_loss_free_area_ratio = [1, 1, 1], quadratic_loss_free_area_ratio = [1, 1, 1]): + def assign_device_resistance( + self, + objects, + boundary_name=None, + total_power="0W", + fluid="air", + laminar=False, + linear_loss=["1m_per_sec", "1m_per_sec", "1m_per_sec"], + quadratic_loss=[1, 1, 1], + linear_loss_free_area_ratio=[1, 1, 1], + quadratic_loss_free_area_ratio=[1, 1, 1], + ): """ Assign resistance boundary condition using the device/approach model. @@ -5474,17 +5546,34 @@ def assign_device_resistance(self, objects, boundary_name=None, total_power="0W" Examples -------- """ - return self.assign_resistance(objects, boundary_name=boundary_name, total_power=total_power, fluid=fluid, - laminar=laminar, loss_type="Device", linear_loss=linear_loss, - quadratic_loss=quadratic_loss, - linear_loss_free_area_ratio = linear_loss_free_area_ratio, - quadratic_loss_free_area_ratio = quadratic_loss_free_area_ratio) + return self.assign_resistance( + objects, + boundary_name=boundary_name, + total_power=total_power, + fluid=fluid, + laminar=laminar, + loss_type="Device", + linear_loss=linear_loss, + quadratic_loss=quadratic_loss, + linear_loss_free_area_ratio=linear_loss_free_area_ratio, + quadratic_loss_free_area_ratio=quadratic_loss_free_area_ratio, + ) @pyaedt_function_handler() - def assign_recirculation_opening(self, face_list, extract_face, thermal_specification="Temperature", - assignment_value="0cel", conductance_external_temperature=None, - flow_specification="Mass Flow", flow_assignment="0kg_per_s_m2", - flow_direction=None, start_time=None, end_time=None, boundary_name=None): + def assign_recirculation_opening( + self, + face_list, + extract_face, + thermal_specification="Temperature", + assignment_value="0cel", + conductance_external_temperature=None, + flow_specification="Mass Flow", + flow_assignment="0kg_per_s_m2", + flow_direction=None, + start_time=None, + end_time=None, + boundary_name=None, + ): """Assign recirculation faces. Parameters @@ -5555,25 +5644,23 @@ def assign_recirculation_opening(self, face_list, extract_face, thermal_specific return False if conductance_external_temperature is not None and thermal_specification != "Conductance": self.logger.warning( - '``conductance_external_temperature`` does not have any effect unless the ``thermal_specification`` ' - 'is ``"Conductance"``.') + "``conductance_external_temperature`` does not have any effect unless the ``thermal_specification`` " + 'is ``"Conductance"``.' + ) if conductance_external_temperature is not None and thermal_specification != "Conductance": self.logger.warning( - '``conductance_external_temperature`` must be specified when ``thermal_specification`` ' - 'is ``"Conductance"``. Setting ``conductance_external_temperature`` to ``"AmbientTemp"``.') + "``conductance_external_temperature`` must be specified when ``thermal_specification`` " + 'is ``"Conductance"``. Setting ``conductance_external_temperature`` to ``"AmbientTemp"``.' + ) if (start_time is not None or end_time is not None) and not self.solution_type == "Transient": - self.logger.warning( - '``start_time`` and ``end_time`` only effect steady-state simulations.') + self.logger.warning("``start_time`` and ``end_time`` only effect steady-state simulations.") elif self.solution_type == "Transient" and not (start_time is not None and end_time is not None): self.logger.warning( - '``start_time`` and ``end_time`` should be declared for transient simulations. Setting them to "0s".') + '``start_time`` and ``end_time`` should be declared for transient simulations. Setting them to "0s".' + ) start_time = "0s" end_time = "0s" - assignment_dict = { - "Conductance": "Conductance", - "Heat Input": "Heat Flow", - "Temperature": "Temperature Change" - } + assignment_dict = {"Conductance": "Conductance", "Heat Input": "Heat Flow", "Temperature": "Temperature Change"} props = {} if not isinstance(face_list[0], int): face_list = [f.id for f in face_list] @@ -5634,9 +5721,19 @@ def assign_recirculation_opening(self, face_list, extract_face, thermal_specific return _create_boundary(bound) @pyaedt_function_handler() - def assign_blower_type1(self, faces, inlet_face, fan_curve_pressure, fan_curve_flow, blower_power="0W", blade_rpm=0, - blade_angle="0rad", fan_curve_pressure_unit="n_per_meter_sq", - fan_curve_flow_unit="m3_per_s", boundary_name=None): + def assign_blower_type1( + self, + faces, + inlet_face, + fan_curve_pressure, + fan_curve_flow, + blower_power="0W", + blade_rpm=0, + blade_angle="0rad", + fan_curve_pressure_unit="n_per_meter_sq", + fan_curve_flow_unit="m3_per_s", + boundary_name=None, + ): """Assign blower type 1. Parameters @@ -5697,13 +5794,31 @@ def assign_blower_type1(self, faces, inlet_face, fan_curve_pressure, fan_curve_f props["Blade RPM"] = blade_rpm props["Fan Blade Angle"] = blade_angle props["Blower Type"] = "Type 1" - return self._assign_blower(props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, - fan_curve_flow, fan_curve_pressure, blower_power, boundary_name) + return self._assign_blower( + props, + faces, + inlet_face, + fan_curve_flow_unit, + fan_curve_pressure_unit, + fan_curve_flow, + fan_curve_pressure, + blower_power, + boundary_name, + ) @pyaedt_function_handler() - def assign_blower_type2(self, faces, inlet_face, fan_curve_pressure, fan_curve_flow, blower_power="0W", - exhaust_angle="0rad", fan_curve_pressure_unit="n_per_meter_sq", - fan_curve_flow_unit="m3_per_s", boundary_name=None): + def assign_blower_type2( + self, + faces, + inlet_face, + fan_curve_pressure, + fan_curve_flow, + blower_power="0W", + exhaust_angle="0rad", + fan_curve_pressure_unit="n_per_meter_sq", + fan_curve_flow_unit="m3_per_s", + boundary_name=None, + ): """Assign blower type 2. Parameters @@ -5759,12 +5874,31 @@ def assign_blower_type2(self, faces, inlet_face, fan_curve_pressure, fan_curve_f props = {} props["Exhaust Exit Angle"] = exhaust_angle props["Blower Type"] = "Type 2" - return self._assign_blower(props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, - fan_curve_flow, fan_curve_pressure, blower_power, boundary_name) + return self._assign_blower( + props, + faces, + inlet_face, + fan_curve_flow_unit, + fan_curve_pressure_unit, + fan_curve_flow, + fan_curve_pressure, + blower_power, + boundary_name, + ) @pyaedt_function_handler() - def _assign_blower(self, props, faces, inlet_face, fan_curve_flow_unit, fan_curve_pressure_unit, fan_curve_flow, - fan_curve_pressure, blower_power, boundary_name): + def _assign_blower( + self, + props, + faces, + inlet_face, + fan_curve_flow_unit, + fan_curve_pressure_unit, + fan_curve_flow, + fan_curve_pressure, + blower_power, + boundary_name, + ): if isinstance(faces[0], int): props["Faces"] = faces else: @@ -5786,11 +5920,21 @@ def _assign_blower(self, props, faces, inlet_face, fan_curve_flow_unit, fan_curv return _create_boundary(bound) @pyaedt_function_handler() - def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W", - thermal_specification="Thickness", thickness="1mm", solid_material="Al-Extruded", - conductance="0W_per_Cel", shell_conduction=False, thermal_resistance="0Kel_per_W", - low_side_rad_material=None, high_side_rad_material=None, - thermal_impedance="0celm2_per_W"): + def assign_conducting_plate( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thermal_specification="Thickness", + thickness="1mm", + solid_material="Al-Extruded", + conductance="0W_per_Cel", + shell_conduction=False, + thermal_resistance="0Kel_per_W", + low_side_rad_material=None, + high_side_rad_material=None, + thermal_impedance="0celm2_per_W", + ): """ Assign thermal boundary conditions to a conducting plate. @@ -5867,9 +6011,9 @@ def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W props["Total Power"] = total_power props["Thermal Specification"] = thermal_specification for value, key, unit in zip( - [thickness, conductance, thermal_resistance, thermal_impedance], - ["Thickness", "Conductance", "Thermal Resistance", "Thermal Impedance"], - ["mm", "W_per_Cel", "Kel_per_W", "Cel_m2_per_W"] + [thickness, conductance, thermal_resistance, thermal_impedance], + ["Thickness", "Conductance", "Thermal Resistance", "Thermal Impedance"], + ["mm", "W_per_Cel", "Kel_per_W", "Cel_m2_per_W"], ): if thermal_specification == key: if not isinstance(value, str): @@ -5880,25 +6024,32 @@ def assign_conducting_plate(self, obj_plate, boundary_name=None, total_power="0W if low_side_rad_material is not None: props["LowSide"] = {"Radiate": False} else: - props["LowSide"] = {"Radiate": True, - "RadiateTo": "AllObjects", - "Surface Material": low_side_rad_material} + props["LowSide"] = {"Radiate": True, "RadiateTo": "AllObjects", "Surface Material": low_side_rad_material} if high_side_rad_material is not None: props["LowSide"] = {"Radiate": False} else: - props["HighSide"] = {"Radiate": True, - "RadiateTo - High": "AllObjects - High", - "Surface Material - High": high_side_rad_material} + props["HighSide"] = { + "Radiate": True, + "RadiateTo - High": "AllObjects - High", + "Surface Material - High": high_side_rad_material, + } props["Shell Conduction"] = shell_conduction if not boundary_name: boundary_name = generate_unique_name("Plate") bound = BoundaryObject(self, boundary_name, props, "Conducting Plate") return _create_boundary(bound) - def assign_conducting_plate_with_thickness(self, obj_plate, boundary_name=None, total_power="0W", - thickness="1mm", solid_material="Al-Extruded", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + def assign_conducting_plate_with_thickness( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thickness="1mm", + solid_material="Al-Extruded", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with thickness specification to a conducting plate. @@ -5937,20 +6088,28 @@ def assign_conducting_plate_with_thickness(self, obj_plate, boundary_name=None, Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thickness", - thickness=thickness, - solid_material=solid_material, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) - - def assign_conducting_plate_with_resistance(self, obj_plate, boundary_name=None, total_power="0W", - thermal_resistance="0Kel_per_W", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thickness", + thickness=thickness, + solid_material=solid_material, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) + + def assign_conducting_plate_with_resistance( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thermal_resistance="0Kel_per_W", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with thermal resistance specification to a conducting plate. @@ -5986,19 +6145,27 @@ def assign_conducting_plate_with_resistance(self, obj_plate, boundary_name=None, Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thermal Resistance", - thermal_resistance=thermal_resistance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) - - def assign_conducting_plate_with_impedance(self, obj_plate, boundary_name=None, total_power="0W", - thermal_impedance="0celm2_per_W", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thermal Resistance", + thermal_resistance=thermal_resistance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) + + def assign_conducting_plate_with_impedance( + self, + obj_plate, + boundary_name=None, + total_power="0W", + thermal_impedance="0celm2_per_W", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with thermal impedance specification to a conducting plate. @@ -6034,19 +6201,27 @@ def assign_conducting_plate_with_impedance(self, obj_plate, boundary_name=None, Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Thermal Impedance", - thermal_impedance=thermal_impedance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) - - def assign_conducting_plate_with_conductance(self, obj_plate, boundary_name=None, total_power="0W", - conductance="0W_per_Cel", - shell_conduction=False, low_side_rad_material=None, - high_side_rad_material=None): + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Thermal Impedance", + thermal_impedance=thermal_impedance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) + + def assign_conducting_plate_with_conductance( + self, + obj_plate, + boundary_name=None, + total_power="0W", + conductance="0W_per_Cel", + shell_conduction=False, + low_side_rad_material=None, + high_side_rad_material=None, + ): """ Assign thermal boundary conditions with conductance specification to a conducting plate. @@ -6082,14 +6257,16 @@ def assign_conducting_plate_with_conductance(self, obj_plate, boundary_name=None Boundary object when successful or ``None`` when failed. """ - return self.assign_conducting_plate(obj_plate, - boundary_name=boundary_name, - total_power=total_power, - thermal_specification="Conductance", - conductance=conductance, - shell_conduction=shell_conduction, - low_side_rad_material=low_side_rad_material, - high_side_rad_material=high_side_rad_material) + return self.assign_conducting_plate( + obj_plate, + boundary_name=boundary_name, + total_power=total_power, + thermal_specification="Conductance", + conductance=conductance, + shell_conduction=shell_conduction, + low_side_rad_material=low_side_rad_material, + high_side_rad_material=high_side_rad_material, + ) @pyaedt_function_handler def __create_dataset_assignment(self, type_assignment, ds_name, scale): diff --git a/pyaedt/maxwell.py b/pyaedt/maxwell.py index 2489fd112f0..13eed00c14f 100644 --- a/pyaedt/maxwell.py +++ b/pyaedt/maxwell.py @@ -2915,7 +2915,7 @@ def xy_plane(self, value=True): @property def model_depth(self): """Model depth.""" - design_settings = self.design_settings() + design_settings = self.design_settings if "ModelDepth" in design_settings: value_str = design_settings["ModelDepth"] return value_str From 95e15fc735ee8e56e27642f4e7e6c463880338fe Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Fri, 26 Apr 2024 20:34:57 +0200 Subject: [PATCH 10/22] Fix ironpy ut --- pyaedt/icepak.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 237f3d739d6..e0f2fd181d9 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1983,6 +1983,7 @@ def eval_volume_quantity_from_field_summary( ) return filename + @pyaedt_function_handler(geometryType="geometry_type", variationlist="variation_list") def export_summary( self, output_dir=None, @@ -1993,7 +1994,6 @@ def export_summary( variation="", variation_list=None, filename="IPKsummaryReport", - **kwargs, ): """Export a fields summary of all objects. @@ -2030,16 +2030,6 @@ def export_summary( >>> oModule.EditFieldsSummarySetting >>> oModule.ExportFieldsSummary """ - if "geometryType" in kwargs: - warnings.warn("The 'geometryType' argument is deprecated. Use 'geometry_type' instead.", DeprecationWarning) - - if "variationlist" in kwargs: - warnings.warn( - "The 'variationlist' argument is deprecated. Use 'variation_list' instead.", DeprecationWarning - ) - - geometry_type = kwargs.get("geometryType", geometry_type) - variation_list = kwargs.get("variationlist", variation_list) if variation_list is None: variation_list = [] From 13ba80f90c755cce84e0154b6a7f83c01d0a1920 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Fri, 26 Apr 2024 20:46:30 +0200 Subject: [PATCH 11/22] Fix ironpy ut --- _unittest/test_98_Icepak.py | 3 +- pyaedt/icepak.py | 96 +++++++++++-------------------------- 2 files changed, 28 insertions(+), 71 deletions(-) diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index bc862130f03..729cbf00cf5 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -950,7 +950,6 @@ def test_54_assign_stationary_wall(self): thickness="0mm", material="Al-Extruded", htc=10, - htc_dataset=None, ref_temperature="AmbientTemp", ht_correlation=True, ht_correlation_type="Forced Convection", @@ -966,7 +965,7 @@ def test_54_assign_stationary_wall(self): name=None, thickness="0mm", material="Al-Extruded", - htc_dataset="ds1", + htc="ds1", ref_temperature="AmbientTemp", ht_correlation=False, ) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index e0f2fd181d9..07c31947c68 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -3486,7 +3486,7 @@ def get_face_normal(obj_face): return boundary return None - @pyaedt_function_handler() + @pyaedt_function_handler(htc_dataset="htc") def assign_stationary_wall( self, geometry, @@ -3514,7 +3514,6 @@ def assign_stationary_wall( ext_surf_rad_material="Stainless-steel-cleaned", ext_surf_rad_ref_temp="AmbientTemp", ext_surf_rad_view_factor="1", - **kwargs, ): """Assign surface wall boundary condition. @@ -3663,18 +3662,6 @@ def assign_stationary_wall( props["Thickness"] = (thickness,) props["Solid Material"] = material props["External Condition"] = boundary_condition - if "htc_dataset" in kwargs: # backward compatibility - warnings.warn( - "``htc_dataset`` argument is being deprecated. Create a dictionary as per" - "documentation and assign it to the ``htc`` argument.", - DeprecationWarning, - ) - if kwargs["htc_dataset"] is not None: - htc = { - "Type": "Temp Dep", - "Function": "Piecewise Linear", - "Values": kwargs["htc_dataset"], - } for quantity, assignment_value, to_add in [ ("External Radiation Reference Temperature", ext_surf_rad_ref_temp, ext_surf_rad), ("Heat Transfer Coefficient", htc, boundary_condition == "Heat Transfer Coefficient"), @@ -3855,7 +3842,7 @@ def assign_stationary_wall_with_temperature( shell_conduction=shell_conduction, ) - @pyaedt_function_handler() + @pyaedt_function_handler(htc_dataset="htc") def assign_stationary_wall_with_htc( self, geometry, @@ -3880,7 +3867,6 @@ def assign_stationary_wall_with_htc( radiate=False, radiate_surf_mat="Steel-oxidised-surface", shell_conduction=False, - **kwargs, ): """Assign a surface wall boundary condition with specified heat transfer coefficient. @@ -3980,59 +3966,31 @@ def assign_stationary_wall_with_htc( >>> oModule.AssignStationaryWallBoundary """ - if kwargs.get("htc_dataset", None): - return self.assign_stationary_wall( - geometry, - "Heat Transfer Coefficient", - name=name, - thickness=thickness, - material=material, - htc=htc, - htc_dataset=kwargs["htc_dataset"], - ref_temperature=ref_temperature, - ht_correlation=ht_correlation, - ht_correlation_type=ht_correlation_type, - ht_correlation_fluid=ht_correlation_fluid, - ht_correlation_flow_type=ht_correlation_flow_type, - ht_correlation_flow_direction=ht_correlation_flow_direction, - ht_correlation_value_type=ht_correlation_value_type, - ht_correlation_free_stream_velocity=ht_correlation_free_stream_velocity, - ht_correlation_surface=ht_correlation_amb_temperature, - ht_correlation_amb_temperature=ht_correlation_surface, - ext_surf_rad=ext_surf_rad, - ext_surf_rad_material=ext_surf_rad_material, - ext_surf_rad_ref_temp=ext_surf_rad_ref_temp, - ext_surf_rad_view_factor=ext_surf_rad_view_factor, - radiate=radiate, - radiate_surf_mat=radiate_surf_mat, - shell_conduction=shell_conduction, - ) - else: - return self.assign_stationary_wall( - geometry, - "Heat Transfer Coefficient", - name=name, - thickness=thickness, - material=material, - htc=htc, - ref_temperature=ref_temperature, - ht_correlation=ht_correlation, - ht_correlation_type=ht_correlation_type, - ht_correlation_fluid=ht_correlation_fluid, - ht_correlation_flow_type=ht_correlation_flow_type, - ht_correlation_flow_direction=ht_correlation_flow_direction, - ht_correlation_value_type=ht_correlation_value_type, - ht_correlation_free_stream_velocity=ht_correlation_free_stream_velocity, - ht_correlation_surface=ht_correlation_amb_temperature, - ht_correlation_amb_temperature=ht_correlation_surface, - ext_surf_rad=ext_surf_rad, - ext_surf_rad_material=ext_surf_rad_material, - ext_surf_rad_ref_temp=ext_surf_rad_ref_temp, - ext_surf_rad_view_factor=ext_surf_rad_view_factor, - radiate=radiate, - radiate_surf_mat=radiate_surf_mat, - shell_conduction=shell_conduction, - ) + return self.assign_stationary_wall( + geometry, + "Heat Transfer Coefficient", + name=name, + thickness=thickness, + material=material, + htc=htc, + ref_temperature=ref_temperature, + ht_correlation=ht_correlation, + ht_correlation_type=ht_correlation_type, + ht_correlation_fluid=ht_correlation_fluid, + ht_correlation_flow_type=ht_correlation_flow_type, + ht_correlation_flow_direction=ht_correlation_flow_direction, + ht_correlation_value_type=ht_correlation_value_type, + ht_correlation_free_stream_velocity=ht_correlation_free_stream_velocity, + ht_correlation_surface=ht_correlation_amb_temperature, + ht_correlation_amb_temperature=ht_correlation_surface, + ext_surf_rad=ext_surf_rad, + ext_surf_rad_material=ext_surf_rad_material, + ext_surf_rad_ref_temp=ext_surf_rad_ref_temp, + ext_surf_rad_view_factor=ext_surf_rad_view_factor, + radiate=radiate, + radiate_surf_mat=radiate_surf_mat, + shell_conduction=shell_conduction, + ) @pyaedt_function_handler(setupname="name", setuptype="setup_type") def create_setup(self, name="MySetupAuto", setup_type=None, **kwargs): From 3c5f799a2919625d5bfd9af36cc7756db068611d Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Mon, 29 Apr 2024 12:22:36 +0200 Subject: [PATCH 12/22] add transient support --- _unittest/test_98_Icepak.py | 3 + pyaedt/icepak.py | 112 ++++++++++++++++-------------------- 2 files changed, 54 insertions(+), 61 deletions(-) diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index 729cbf00cf5..7f88ca054f6 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -292,6 +292,9 @@ def test_14_edit_design_settings(self): assert self.aedtapp.edit_design_settings(gravity_dir=3) assert self.aedtapp.edit_design_settings(ambtemp=20) assert self.aedtapp.edit_design_settings(ambtemp="325kel") + self.aedtapp.solution_type = "Transient" + bc = self.aedtapp.create_linear_transient_assignment("0.01cel", "5") + assert self.aedtapp.edit_design_settings(ambtemp=bc) def test_15_insert_new_icepak(self): self.aedtapp.insert_design("Solve") diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 07c31947c68..c64ad81e1fe 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -23,6 +23,7 @@ from pyaedt.application.Analysis3D import FieldAnalysis3D from pyaedt.generic.DataHandlers import _arg2dict +from pyaedt.generic.DataHandlers import _dict2arg from pyaedt.generic.DataHandlers import random_string from pyaedt.generic.configurations import ConfigurationsIcepak from pyaedt.generic.general_methods import generate_unique_name @@ -1635,7 +1636,7 @@ def edit_design_settings( gravity_dir : int, optional Gravity direction from -X to +Z. Options are ``0`` to ``5``. The default is ``0``. - ambient_temperature : float, str, optional + ambient_temperature : float, str, BoundaryDict or dict optional Ambient temperature. The default is ``20``. The default unit is celsius for float or string including unit definition is accepted, e.g. ``325kel``. perform_validation : bool, optional @@ -1683,34 +1684,44 @@ def edit_design_settings( if int(gravity_dir) > 2: gv_pos = True gva = ice_gravity[int(gravity_dir) - 3] + arg1 = [ + "NAME:Design Settings Data", + "Perform Minimal validation:=", + perform_validation, + "Default Fluid Material:=", + default_fluid, + "Default Solid Material:=", + default_solid, + "Default Surface Material:=", + default_surface, + "AmbientPressure:=", + self.value_with_units(gauge_pressure, "n_per_meter_sq"), + "AmbientRadiationTemperature:=", + self.value_with_units(radiation_temperature, "cel"), + "Gravity Vector CS ID:=", + 1, + "Gravity Vector Axis:=", + gva, + "Positive:=", + gv_pos, + "ExportOnSimulationComplete:=", + export_monitor, + "ExportDirectory:=", + export_directory, + ] + if not isinstance(ambient_temperature, (BoundaryDictionary, dict)): + arg1.append("AmbientTemperature:=") + arg1.append(self.value_with_units(ambient_temperature, "cel")) + else: + assignment = self._parse_variation_data( + "Ambient Temperature", + "Transient", + variation_value=ambient_temperature["Values"], + function=ambient_temperature["Function"], + ) + _dict2arg(assignment, arg1) self._odesign.SetDesignSettings( - [ - "NAME:Design Settings Data", - "Perform Minimal validation:=", - perform_validation, - "Default Fluid Material:=", - default_fluid, - "Default Solid Material:=", - default_solid, - "Default Surface Material:=", - default_surface, - "AmbientTemperature:=", - self.value_with_units(ambient_temperature, "cel"), - "AmbientPressure:=", - self.value_with_units(gauge_pressure, "n_per_meter_sq"), - "AmbientRadiationTemperature:=", - self.value_with_units(radiation_temperature, "cel"), - "Gravity Vector CS ID:=", - 1, - "Gravity Vector Axis:=", - gva, - "Positive:=", - gv_pos, - "ExportOnSimulationComplete:=", - export_monitor, - "ExportDirectory:=", - export_directory, - ], + arg1, [ "NAME:Model Validation Settings", "EntityCheckLevel:=", @@ -3060,6 +3071,9 @@ def apply_icepak_settings( ): """Apply Icepak default design settings. + .. deprecated:: 0.8.9 + Use ``edit_design_settins`` method. + Parameters ---------- ambienttemp : float, str, optional @@ -3087,40 +3101,16 @@ def apply_icepak_settings( >>> oDesign.SetDesignSettings """ - ambient_temperature = self.modeler._arg_with_dim(ambienttemp, "cel") - - axes = ["X", "Y", "Z"] - GVPos = False - if int(gravityDir) > 2: - GVPos = True - gravity_axis = axes[int(gravityDir) - 3] - self.odesign.SetDesignSettings( - [ - "NAME:Design Settings Data", - "Perform Minimal validation:=", - perform_minimal_val, - "Default Fluid Material:=", - default_fluid, - "Default Solid Material:=", - default_solid, - "Default Surface Material:=", - default_surface, - "AmbientTemperature:=", - ambient_temperature, - "AmbientPressure:=", - "0n_per_meter_sq", - "AmbientRadiationTemperature:=", - ambient_temperature, - "Gravity Vector CS ID:=", - 1, - "Gravity Vector Axis:=", - gravity_axis, - "Positive:=", - GVPos, - ], - ["NAME:Model Validation Settings"], + + warnings.warn("Use ``edit_design_settins`` method.", DeprecationWarning) + return self.edit_design_settings( + ambient_temperature=ambienttemp, + gravity_dir=gravityDir, + perform_validation=perform_minimal_val, + default_fluid=default_fluid, + default_solid=default_solid, + default_surface=default_surface, ) - return True @pyaedt_function_handler() def assign_surface_material(self, obj, mat): From 8b1170782ac65eaba053e3bc275b198ea2411b17 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Mon, 29 Apr 2024 14:41:50 +0200 Subject: [PATCH 13/22] add sherlock option --- pyaedt/icepak.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index c64ad81e1fe..9d9da9ceb7c 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1623,6 +1623,7 @@ def edit_design_settings( default_solid="Al-Extruded", default_surface="Steel-oxidised-surface", export_monitor=False, + export_sherlock=False, export_directory=os.getcwd(), gauge_pressure=0, radiation_temperature=20, @@ -1651,10 +1652,14 @@ def edit_design_settings( default_surface : str, optional Default surface material. The default is ``"Steel-oxidised-surface"``. export_monitor : bool, optional - Whether to use the default export directory for monitor point data. + Whether to export monitor data. + The default value is ``False``. + export_sherlock : bool, optional + Whether to export temperature data for Sherlock. The default value is ``False``. export_directory : str, optional - Default export directory for monitor point data. The default value is the current working directory. + Default export directory for monitor point and sherlock data. + The default value is the current working directory. gauge_pressure : float, str, optional Set the Gauge pressure. It can be a float (units will be "n_per_meter_sq") or a string with units. Default is ``0``. @@ -1694,6 +1699,12 @@ def edit_design_settings( default_solid, "Default Surface Material:=", default_surface, + "SherlockExportOnSimulationComplete:=", + export_sherlock, + "SherlockExportAsFatigue:=", + True, + "SherlockExportDirectory:=", + export_directory, "AmbientPressure:=", self.value_with_units(gauge_pressure, "n_per_meter_sq"), "AmbientRadiationTemperature:=", From f5efcc4fe47f1c6eb57424e77c28cf913146bc16 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Mon, 29 Apr 2024 15:10:52 +0200 Subject: [PATCH 14/22] fix documentation --- pyaedt/icepak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 9d9da9ceb7c..07f9b08d253 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -662,7 +662,7 @@ def create_source_power( thermal_dependent_dataset : str, optional Name of the dataset if a thermal dependent power source is to be assigned. The default is ``None``. input_power : str, float, or int, optional - Input power. The default is ``"0W"``. + Input power. The default is ``None``. thermal_condtion : str, optional Thermal condition. The default is ``"Total Power"``. surface_heat : str, optional From 4f78750ed915af2c8968e511aa34583b68da5739 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Mon, 29 Apr 2024 15:11:26 +0200 Subject: [PATCH 15/22] fix tests --- _unittest/test_98_Icepak.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_unittest/test_98_Icepak.py b/_unittest/test_98_Icepak.py index 7f88ca054f6..dcc16aa5c9b 100644 --- a/_unittest/test_98_Icepak.py +++ b/_unittest/test_98_Icepak.py @@ -407,6 +407,7 @@ def test_33_create_source(self): assert self.aedtapp.create_source_power(self.aedtapp.modeler["boxSource"].top_face_z.id, input_power="2W") assert self.aedtapp.create_source_power( self.aedtapp.modeler["boxSource"].bottom_face_z.id, + input_power="0W", thermal_condtion="Fixed Temperature", temperature="28cel", ) @@ -429,6 +430,7 @@ def test_33_create_source(self): voltage_current_choice="Current", voltage_current_value="1A", ) + self.aedtapp.solution_type = "SteadyState" assert not self.aedtapp.assign_source( self.aedtapp.modeler["boxSource"].top_face_x.id, "Total Power", From 10d6606edf8a1826f48102c56ba650877f492f6b Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti <58366962+lorenzovecchietti@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:16:09 +0200 Subject: [PATCH 16/22] Update pyaedt/application/Design.py --- pyaedt/application/Design.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 21480772395..c587e4a0f07 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4050,6 +4050,7 @@ def __init__(self, app, manipulate_inputs): @property def available_properties(self): + """Available properties names for the current design.""" return [prop for prop in self.design_settings.GetPropNames() if not prop.endswith("/Choices")] def __repr__(self): From a4dba122457db8daac52d6ea99842be7547326dc Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Tue, 30 Apr 2024 15:46:55 +0200 Subject: [PATCH 17/22] improve architecture --- pyaedt/application/Design.py | 12 ++++-------- pyaedt/icepak.py | 6 ++++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index c587e4a0f07..90d34fc41df 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4020,14 +4020,10 @@ def set_temporary_directory(self, temp_dir_path): self.odesktop.SetTempDirectory(temp_dir_path) return True - @pyaedt_function_handler() - def _manipulate_design_settings_inputs(self, k, v): - return v - @property def design_settings(self): """Design settings for the AEDT app.""" - return DesignSettings(self, self._manipulate_design_settings_inputs) + return DesignSettings(self) class DesignSettings: @@ -4039,9 +4035,9 @@ class DesignSettings: >>> oDesign.GetChildObject("Design Settings") """ - def __init__(self, app, manipulate_inputs): + def __init__(self, app): self._app = app - self._manipulate_inputs = manipulate_inputs + self.manipulate_inputs = None try: self.design_settings = self._app.odesign.GetChildObject("Design Settings") except GrpcApiError: # pragma: no cover @@ -4062,7 +4058,7 @@ def __repr__(self): def __setitem__(self, key, value): if key in self.available_properties: - value = self._manipulate_inputs(key, value) + value = self.manipulate_inputs.execute(key, value) key_choices = "{}/Choices".format(key) if key_choices in self.design_settings.GetPropNames(): value_choices = self.design_settings.GetPropValue(key_choices) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 07f9b08d253..f85b288f210 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -175,6 +175,7 @@ def __init__( ) self._monitor = Monitor(self) self._configurations = ConfigurationsIcepak(self) + self.design_settings.manipulate_inputs = IcepakDesignSettingsManipulation() def _init_from_design(self, *args, **kwargs): self.__init__(*args, **kwargs) @@ -6425,8 +6426,9 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on """ return SquareWaveDictionary(on_value, initial_time_off, on_time, off_time, off_value) - @pyaedt_function_handler() - def _manipulate_design_settings_inputs(self, k, v): + +class IcepakDesignSettingsManipulation: + def execute(self, k, v): if k in ["AmbTemp", "AmbRadTemp"]: if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)): self.logger.error("Failed. Use `edit_design_settings` function.") From 1813ab0dfcb779b0f1e3eb86061f63baddd3e618 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti <58366962+lorenzovecchietti@users.noreply.github.com> Date: Thu, 2 May 2024 09:37:02 +0200 Subject: [PATCH 18/22] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sébastien Morais <146729917+SMoraisAnsys@users.noreply.github.com> Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- pyaedt/application/Design.py | 7 +++---- pyaedt/icepak.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 90d34fc41df..8bf840f3125 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -4058,7 +4058,8 @@ def __repr__(self): def __setitem__(self, key, value): if key in self.available_properties: - value = self.manipulate_inputs.execute(key, value) + if self.manipulate_inputs is not None: + value = self.manipulate_inputs.execute(key, value) key_choices = "{}/Choices".format(key) if key_choices in self.design_settings.GetPropNames(): value_choices = self.design_settings.GetPropValue(key_choices) @@ -4079,6 +4080,4 @@ def __getitem__(self, key): return None def __contains__(self, item): - if item in self.available_properties: - return True - return False + return item in self.available_properties diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index f85b288f210..f921a7b75df 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -1640,7 +1640,7 @@ def edit_design_settings( The default is ``0``. ambient_temperature : float, str, BoundaryDict or dict optional Ambient temperature. The default is ``20``. - The default unit is celsius for float or string including unit definition is accepted, e.g. ``325kel``. + The default unit is Celsius for a float or string value. You can include a unit for a string value. For example, ``325kel``. perform_validation : bool, optional Whether to perform validation. The default is ``False``. check_level : str, optional @@ -1654,16 +1654,16 @@ def edit_design_settings( Default surface material. The default is ``"Steel-oxidised-surface"``. export_monitor : bool, optional Whether to export monitor data. - The default value is ``False``. + The default is ``False``. export_sherlock : bool, optional Whether to export temperature data for Sherlock. - The default value is ``False``. + The default is ``False``. export_directory : str, optional - Default export directory for monitor point and sherlock data. - The default value is the current working directory. + Default export directory for monitor point and Sherlock data. + The default is the current working directory. gauge_pressure : float, str, optional - Set the Gauge pressure. It can be a float (units will be "n_per_meter_sq") or a string with units. - Default is ``0``. + Gauge pressure. It can be a float where "n_per_meter_sq" is assumed as the units or a string with the units specified. + The default is ``0``. radiation_temperature : float, str, optional Set the radiation temperature. It can be a float (units will be "cel") or a string with units. Default is ``20``. @@ -1684,7 +1684,7 @@ def edit_design_settings( >>> oDesign.SetDesignSettings """ # - # Configure design settings for gravity etc + # Configure design settings such as gravity ice_gravity = ["X", "Y", "Z"] gv_pos = False if int(gravity_dir) > 2: @@ -3084,7 +3084,7 @@ def apply_icepak_settings( """Apply Icepak default design settings. .. deprecated:: 0.8.9 - Use ``edit_design_settins`` method. + Use the ``edit_design_settins()`` method. Parameters ---------- @@ -3114,7 +3114,7 @@ def apply_icepak_settings( >>> oDesign.SetDesignSettings """ - warnings.warn("Use ``edit_design_settins`` method.", DeprecationWarning) + warnings.warn("Use the ``edit_design_settings()`` method.", DeprecationWarning) return self.edit_design_settings( ambient_temperature=ambienttemp, gravity_dir=gravityDir, @@ -3870,7 +3870,7 @@ def assign_stationary_wall_with_htc( radiate_surf_mat="Steel-oxidised-surface", shell_conduction=False, ): - """Assign a surface wall boundary condition with specified heat transfer coefficient. + """Assign a surface wall boundary condition with a given heat transfer coefficient. Parameters ---------- @@ -6433,7 +6433,7 @@ def execute(self, k, v): if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)): self.logger.error("Failed. Use `edit_design_settings` function.") return self.design_settings["AmbTemp"] - # Bug in native API. Uncomment when fixed + # FIXME: Bug in native API. Uncomment when fixed # if not self.solution_type == "Transient": # self.logger.error("Transient assignment is supported only in transient designs.") # return False From 8b05d737ffadda66dffa53b52d99f4e8f8c7a1fb Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Thu, 2 May 2024 09:42:06 +0200 Subject: [PATCH 19/22] add abstract class --- pyaedt/application/Design.py | 8 ++++++++ pyaedt/icepak.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 90d34fc41df..0cc67d5ba22 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -8,6 +8,8 @@ from __future__ import absolute_import # noreorder +from abc import ABC +from abc import abstractmethod from collections import OrderedDict import gc import json @@ -4082,3 +4084,9 @@ def __contains__(self, item): if item in self.available_properties: return True return False + + +class DesignSettingsManipulation(ABC): + @abstractmethod + def execute(self, k, v): + pass diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index f85b288f210..1ab5341ec59 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -9,6 +9,7 @@ from pyaedt import is_ironpython from pyaedt import is_linux +from pyaedt.application.Design import DesignSettingsManipulation from pyaedt.generic.general_methods import GrpcApiError from pyaedt.modeler.cad.elements3d import FacePrimitive from pyaedt.modeler.geometry_operators import GeometryOperators as go @@ -6427,7 +6428,7 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on return SquareWaveDictionary(on_value, initial_time_off, on_time, off_time, off_value) -class IcepakDesignSettingsManipulation: +class IcepakDesignSettingsManipulation(DesignSettingsManipulation): def execute(self, k, v): if k in ["AmbTemp", "AmbRadTemp"]: if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)): From 101436f4003282ed05805aa01a81ce522a0c4b0f Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Thu, 2 May 2024 09:45:01 +0200 Subject: [PATCH 20/22] add app attribute --- pyaedt/icepak.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pyaedt/icepak.py b/pyaedt/icepak.py index 1ab5341ec59..6e63516b646 100644 --- a/pyaedt/icepak.py +++ b/pyaedt/icepak.py @@ -176,7 +176,7 @@ def __init__( ) self._monitor = Monitor(self) self._configurations = ConfigurationsIcepak(self) - self.design_settings.manipulate_inputs = IcepakDesignSettingsManipulation() + self.design_settings.manipulate_inputs = IcepakDesignSettingsManipulation(self) def _init_from_design(self, *args, **kwargs): self.__init__(*args, **kwargs) @@ -6429,11 +6429,14 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on class IcepakDesignSettingsManipulation(DesignSettingsManipulation): + def __init__(self, app): + self.app = app + def execute(self, k, v): if k in ["AmbTemp", "AmbRadTemp"]: if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)): - self.logger.error("Failed. Use `edit_design_settings` function.") - return self.design_settings["AmbTemp"] + self.app.logger.error("Failed. Use `edit_design_settings` function.") + return self.app.design_settings["AmbTemp"] # Bug in native API. Uncomment when fixed # if not self.solution_type == "Transient": # self.logger.error("Transient assignment is supported only in transient designs.") @@ -6450,18 +6453,18 @@ def execute(self, k, v): # self.logger.error("Transient dictionary is not valid.") # return False else: - return self.value_with_units(v, "cel") + return self.app.value_with_units(v, "cel") elif k == "AmbGaugePressure": - return self.value_with_units(v, "n_per_meter_sq") + return self.app.value_with_units(v, "n_per_meter_sq") elif k == "GravityVec": if isinstance(v, (float, int)): - self.design_settings["GravityDir"] = ["Positive", "Negative"][v // 3] + self.app.design_settings["GravityDir"] = ["Positive", "Negative"][v // 3] v = "Global::{}".format(["X", "Y", "Z"][v - v // 3 * 3]) return v else: if len(v.split("::")) == 1 and len(v) < 3: if v.startswith("+") or v.startswith("-"): - self.design_settings["GravityDir"] = ["Positive", "Negative"][int(v.startswith("-"))] + self.app.design_settings["GravityDir"] = ["Positive", "Negative"][int(v.startswith("-"))] v = v[-1] return "Global::{}".format(v) else: From a4ee76f300fdd0074d3d057c9943137563f4f257 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Thu, 2 May 2024 09:52:44 +0200 Subject: [PATCH 21/22] ironpy compatibility --- pyaedt/application/Design.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index fd6598eab6a..8bba9319e15 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -8,7 +8,6 @@ from __future__ import absolute_import # noreorder -from abc import ABC from abc import abstractmethod from collections import OrderedDict import gc @@ -4085,7 +4084,7 @@ def __contains__(self, item): return item in self.available_properties -class DesignSettingsManipulation(ABC): +class DesignSettingsManipulation: @abstractmethod def execute(self, k, v): pass From 969fdd1f039a03f1169b1319359f184d914f2979 Mon Sep 17 00:00:00 2001 From: Lorenzo Vecchietti Date: Thu, 2 May 2024 10:45:12 +0200 Subject: [PATCH 22/22] fix --- pyaedt/application/Design.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyaedt/application/Design.py b/pyaedt/application/Design.py index 8bba9319e15..641c67df08a 100644 --- a/pyaedt/application/Design.py +++ b/pyaedt/application/Design.py @@ -276,6 +276,7 @@ def __init__( self._variable_manager = VariableManager(self) self._project_datasets = [] self._design_datasets = [] + self.design_settings = DesignSettings(self) @property def desktop_class(self): @@ -4021,11 +4022,6 @@ def set_temporary_directory(self, temp_dir_path): self.odesktop.SetTempDirectory(temp_dir_path) return True - @property - def design_settings(self): - """Design settings for the AEDT app.""" - return DesignSettings(self) - class DesignSettings: """Get design settings for the current AEDT app.