Skip to content

Commit

Permalink
Merge branch 'main' into FEAT__Add_distributed_filters_topology
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin4667 authored Feb 3, 2025
2 parents 390e0d7 + 3c863dc commit 8f34ac0
Show file tree
Hide file tree
Showing 11 changed files with 763 additions and 563 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ jobs:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [package, doc-build]
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: release
permissions:
id-token: write
contents: write
steps:
- name: Release to the public PyPI repository
uses: ansys/actions/release-pypi-public@v8
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ integration-tests = [
"pytest-cov>=4.0.0,<6.1",
]
tests = [
"ipython>=7.30.0,<8.32",
"ipython>=7.30.0,<8.33",
"joblib>=1.0.0,<1.5",
"matplotlib>=3.5.0,<3.11",
"mock>=5.1.0,<5.2",
Expand Down Expand Up @@ -129,7 +129,7 @@ installer = [
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"jupyterlab>=3.6.0,<4.4",
"ipython>=7.30.0,<8.32",
"ipython>=7.30.0,<8.33",
"ipyvtklink>=0.2.0,<0.2.4",
]

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/generic/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ class Circuit(object):
class Mechanical(object):
"""Provides Mechanical solution types."""

(Thermal, Structural, Modal) = ("Thermal", "Structural", "Modal")
(Thermal, Structural, Modal, SteadyStateThermal) = ("Thermal", "Structural", "Modal", "Steady-State Thermal")


class SETUPS(object):
Expand Down
902 changes: 455 additions & 447 deletions src/ansys/aedt/core/maxwell.py

Large diffs are not rendered by default.

51 changes: 29 additions & 22 deletions src/ansys/aedt/core/mechanical.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from __future__ import absolute_import # noreorder

from ansys.aedt.core.application.analysis_3d import FieldAnalysis3D
from ansys.aedt.core.generic.constants import SOLUTIONS
from ansys.aedt.core.generic.errors import AEDTRuntimeError
from ansys.aedt.core.generic.general_methods import generate_unique_name
from ansys.aedt.core.generic.general_methods import pyaedt_function_handler
from ansys.aedt.core.modules.boundary.common import BoundaryObject
Expand Down Expand Up @@ -215,15 +217,16 @@ def assign_em_losses(
----------
>>> oModule.AssignEMLoss
"""
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

if surface_objects is None:
surface_objects = []
if parameters is None:
parameters = []
if assignment is None:
assignment = []

assert "Thermal" in self.solution_type, "This method works only in a Mechanical Thermal analysis."

self.logger.info("Mapping HFSS EM Loss")
oName = self.project_name
if oName == source_project_name or source_project_name is None:
Expand Down Expand Up @@ -283,7 +286,7 @@ def assign_em_losses(
)
def assign_thermal_map(
self,
object_list,
assignment,
design="IcepakDesign1",
setup="Setup1",
sweep="SteadyState",
Expand All @@ -297,7 +300,7 @@ def assign_thermal_map(
Parameters
----------
object_list : list
assignment : list
design : str, optional
Name of the design with the source mapping. The default is ``"IcepakDesign1"``.
Expand All @@ -320,11 +323,12 @@ def assign_thermal_map(
----------
>>> oModule.AssignThermalCondition
"""
if self.solution_type != SOLUTIONS.Mechanical.Structural:
raise AEDTRuntimeError("This method works only in a Mechanical Structural analysis.")

if parameters is None:
parameters = []

assert self.solution_type == "Structural", "This method works only in a Mechanical Structural analysis."

self.logger.info("Mapping HFSS EM Loss")
oName = self.project_name
if oName == source_project_name or source_project_name is None:
Expand All @@ -334,11 +338,11 @@ def assign_thermal_map(
#
# Generate a list of model objects from the lists made previously and use to map the HFSS losses into Icepak.
#
object_list = self.modeler.convert_to_selections(object_list, True)
if not object_list:
allObjects = self.modeler.object_names
assignment = self.modeler.convert_to_selections(assignment, True)
if not assignment:
all_objects = self.modeler.object_names
else:
allObjects = object_list[:]
all_objects = assignment[:]
argparam = {}
for el in self.available_variations.nominal_w_values_dict:
argparam[el] = self.available_variations.nominal_w_values_dict[el]
Expand All @@ -347,7 +351,7 @@ def assign_thermal_map(
argparam[el] = el

props = {
"Objects": allObjects,
"Objects": all_objects,
"Uniform": False,
"Project": projname,
"Product": "ElectronicsDesktop",
Expand Down Expand Up @@ -402,7 +406,8 @@ def assign_uniform_convection(
----------
>>> oModule.AssignConvection
"""
assert "Thermal" in self.solution_type, "This method works only in a Mechanical Thermal analysis."
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
assignment = self.modeler.convert_to_selections(assignment, True)
Expand Down Expand Up @@ -450,7 +455,8 @@ def assign_uniform_temperature(self, assignment, temperature="AmbientTemp", name
----------
>>> oModule.AssignTemperature
"""
assert "Thermal" in self.solution_type, "This method works only in a Mechanical Thermal analysis."
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
assignment = self.modeler.convert_to_selections(assignment, True)
Expand Down Expand Up @@ -495,12 +501,11 @@ def assign_frictionless_support(self, assignment, name=""):
----------
>>> oModule.AssignFrictionlessSupport
"""
if not (self.solution_type == "Structural" or "Modal" in self.solution_type):
self.logger.error("This method works only in Mechanical Structural analysis.")
return False
if self.solution_type not in (SOLUTIONS.Mechanical.Structural, SOLUTIONS.Mechanical.Modal):
raise AEDTRuntimeError("This method works only in a Mechanical Structural analysis.")

props = {}
assignment = self.modeler.convert_to_selections(assignment, True)

if type(assignment) is list:
if type(assignment[0]) is str:
props["Objects"] = assignment
Expand Down Expand Up @@ -539,9 +544,9 @@ def assign_fixed_support(self, assignment, name=""):
----------
>>> oModule.AssignFixedSupport
"""
if not (self.solution_type == "Structural" or "Modal" in self.solution_type):
self.logger.error("This method works only in a Mechanical Structural analysis.")
return False
if self.solution_type not in (SOLUTIONS.Mechanical.Structural, SOLUTIONS.Mechanical.Modal):
raise AEDTRuntimeError("This method works only in a Mechanical Structural analysis.")

props = {}
assignment = self.modeler.convert_to_selections(assignment, True)

Expand Down Expand Up @@ -600,7 +605,8 @@ def assign_heat_flux(self, assignment, heat_flux_type, value, name=""):
----------
>>> oModule.AssignHeatFlux
"""
assert "Thermal" in self.solution_type, "This method works only in a Mechanical Thermal analysis."
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
assignment = self.modeler.convert_to_selections(assignment, True)
Expand Down Expand Up @@ -647,7 +653,8 @@ def assign_heat_generation(self, assignment, value, name=""):
----------
>>> oModule.AssignHeatGeneration
"""
assert "Thermal" in self.solution_type, "This method works only in a Mechanical Thermal analysis."
if self.solution_type not in (SOLUTIONS.Mechanical.Thermal, SOLUTIONS.Mechanical.SteadyStateThermal):
raise AEDTRuntimeError("This method works only in a Mechanical Thermal analysis.")

props = {}
assignment = self.modeler.convert_to_selections(assignment, True)
Expand Down
15 changes: 10 additions & 5 deletions src/ansys/aedt/core/modeler/circuits/primitives_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def create_page_port(self, name, location=None, angle=0):
return self.components[id]

@pyaedt_function_handler()
def create_gnd(self, location=None, angle=0):
def create_gnd(self, location=None, angle=0, page=1):
"""Create a ground.
Parameters
Expand All @@ -380,6 +380,8 @@ def create_gnd(self, location=None, angle=0):
Position on the X and Y axis. The default is ``None``.
angle : optional
Angle rotation in degrees. The default is ``0``.
page: int, optional
Schematics page number. The default value is ``1``.
Returns
-------
Expand All @@ -398,7 +400,7 @@ def create_gnd(self, location=None, angle=0):
angle = math.pi * angle / 180
name = self.oeditor.CreateGround(
["NAME:GroundProps", "Id:=", id],
["NAME:Attributes", "Page:=", 1, "X:=", xpos, "Y:=", ypos, "Angle:=", angle, "Flip:=", False],
["NAME:Attributes", "Page:=", page, "X:=", xpos, "Y:=", ypos, "Angle:=", angle, "Flip:=", False],
)
id = int(name.split(";")[1])
self.add_id_to_component(id)
Expand Down Expand Up @@ -756,6 +758,7 @@ def create_component(
angle=0,
use_instance_id_netlist=False,
global_netlist_list=None,
page=1,
):
"""Create a component from a library.
Expand Down Expand Up @@ -804,7 +807,7 @@ def create_component(
arg1 = ["NAME:ComponentProps", "Name:=", inst_name, "Id:=", str(id)]
xpos, ypos = self._get_location(location)
angle = math.pi * angle / 180
arg2 = ["NAME:Attributes", "Page:=", 1, "X:=", xpos, "Y:=", ypos, "Angle:=", angle, "Flip:=", False]
arg2 = ["NAME:Attributes", "Page:=", page, "X:=", xpos, "Y:=", ypos, "Angle:=", angle, "Flip:=", False]
id = self.oeditor.CreateComponent(arg1, arg2)
id = int(id.split(";")[1])
# self.refresh_all_ids()
Expand Down Expand Up @@ -1201,7 +1204,7 @@ def create_line(self, points, color=0, width=0):
)

@pyaedt_function_handler(points_array="points", wire_name="name")
def create_wire(self, points, name=""):
def create_wire(self, points, name="", page=1):
"""Create a wire.
Parameters
Expand All @@ -1211,6 +1214,8 @@ def create_wire(self, points, name=""):
``[[x1, y1], [x2, y2], ...]``.
name : str, optional
Name of the wire. Default value is ``""``.
page: int, optional
Schematics page number. The default value is ``1``.
Returns
-------
Expand All @@ -1224,7 +1229,7 @@ def create_wire(self, points, name=""):
points = [str(tuple(self._convert_point_to_meter(i))) for i in points]
wire_id = self.create_unique_id()
arg1 = ["NAME:WireData", "Name:=", name, "Id:=", wire_id, "Points:=", points]
arg2 = ["NAME:Attributes", "Page:=", 1]
arg2 = ["NAME:Attributes", "Page:=", page]
try:
wire_id = self.oeditor.CreateWire(arg1, arg2)
w = Wire(self._modeler, composed_name=wire_id)
Expand Down
Loading

0 comments on commit 8f34ac0

Please sign in to comment.