Skip to content

Commit

Permalink
Merge branch 'main' into transient_ambient_temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzovecchietti authored Apr 23, 2024
2 parents 5a0141c + d1a2049 commit a424ea6
Show file tree
Hide file tree
Showing 23 changed files with 241 additions and 219 deletions.
1 change: 1 addition & 0 deletions _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def test_05a_assign_coil(self):
def test_05_draw_region(self):
assert self.aedtapp.modeler.create_air_region(*[300] * 6)

@pytest.mark.skipif(desktop_version == "2024.2", reason="GetDisplacementCurrent not working in 2024.2")
def test_06_eddycurrent(self):
assert self.aedtapp.eddy_effects_on(["Plate"], enable_eddy_effects=True)
oModule = self.aedtapp.odesign.GetModule("BoundarySetup")
Expand Down
48 changes: 24 additions & 24 deletions _unittest/test_30_Q2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,79 +200,79 @@ def test_15_export_equivalent_circuit(self, add_app):
assert q2d.export_equivalent_circuit(os.path.join(self.local_scratch.path, "test_export_circuit.cir"))
assert not q2d.export_equivalent_circuit(os.path.join(self.local_scratch.path, "test_export_circuit.doc"))
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup_name="Setup1",
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup="Setup1",
sweep="LastAdaptive",
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), setup_name="Setup2"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), setup="Setup2"
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup_name="Setup1",
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup="Setup1",
sweep="LastAdaptive",
variations=["r1:0.3mm"],
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup_name="Setup1",
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup="Setup1",
sweep="LastAdaptive",
variations=[" r1 : 0.3 mm "],
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup_name="Setup1",
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup="Setup1",
sweep="LastAdaptive",
variations="r1:0.3mm",
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix_name="Original"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix="Original"
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix_name="Test1"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix="Test1"
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=2
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=2
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=0
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=0
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=1
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=1
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
coupling_limit_type=0,
res_limit="6Mohm",
ind_limit="12nH",
res_limit="6Mohm",
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), lumped_length="34mm"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), lumped_length="34mm"
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), lumped_length="34nounits"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), lumped_length="34nounits"
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
rise_time_value="1e-6",
rise_time_unit="s",
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
rise_time_value="23",
rise_time_unit="m",
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), file_type="WELement"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), file_type="WELement"
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), file_type="test"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), file_type="test"
)
assert q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model_name=q2d_q3d
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model=q2d_q3d
)
assert not q2d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model_name="test"
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model="test"
)
self.aedtapp.close_project(q2d.project_name, save_project=False)

Expand Down
6 changes: 5 additions & 1 deletion _unittest/test_41_3dlayout_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ def test_41_test_create_polygon(self):
@pytest.mark.skipif(config["desktopVersion"] < "2023.2", reason="Working only from 2023 R2")
def test_42_post_processing(self, add_app):
test_post1 = add_app(project_name=test_post, application=Maxwell3d, subfolder=test_subfolder)

assert test_post1.post.create_fieldplot_layers(
[],
"Mag_H",
Expand Down Expand Up @@ -692,6 +691,11 @@ def test_42_post_processing(self, add_app):
intrinsics={"Freq": "1GHz", "Phase": "0deg"},
plot_name="Test_Layers4",
)
assert test_post2.post.create_fieldplot_layers(
["TOP"],
"Mag_E",
intrinsics={"Freq": "1GHz", "Phase": "0deg"},
)
assert test_post2.post.create_fieldplot_layers(
["TOP", "UNNAMED_004"],
"Mag_E",
Expand Down
54 changes: 17 additions & 37 deletions _unittest_solvers/test_31_Q3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,58 +373,38 @@ def test_16_export_equivalent_circuit(self, add_app):
q3d["d"] = "10mm"
q3d.modeler.duplicate_along_line(objid="Box1", vector=[0, "d", 0])
q3d.analyze_setup(q3d.active_setup, cores=6)
assert q3d.export_equivalent_circuit(
os.path.join(self.local_scratch.path, "test_export_circuit.cir"), variations=["d: 10mm"]
)
assert q3d.export_equivalent_circuit(os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
variations=["d: 10mm"])
assert not q3d.export_equivalent_circuit(os.path.join(self.local_scratch.path, "test_export_circuit.doc"))

assert not q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup_name="Setup1",
sweep="LastAdaptive",
variations=["c: 10mm", "d: 20mm"],
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), setup="Setup1",
sweep="LastAdaptive", variations=["c: 10mm", "d: 20mm"])

assert not q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), setup_name="Setup2"
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), setup="Setup2")
assert not q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
setup_name="Setup1",
sweep="Sweep1",
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), setup="Setup1",
sweep="Sweep1")
assert q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix_name="Original"
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix="Original")
assert q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix_name="JointTest"
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix="JointTest")
assert not q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix_name="JointTest1"
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), matrix="JointTest1")
assert not q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=2
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=2)
assert q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=0
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=0)
assert q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=1
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=1)
assert q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"),
coupling_limit_type=0,
cond_limit="3Sie",
cap_limit="4uF",
ind_limit="9uH",
res_limit="2ohm",
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), coupling_limit_type=0,
cap_limit="4uF", ind_limit="9uH", res_limit="2ohm", cond_limit="3Sie")
assert q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model_name="test_14"
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model="test_14")
assert not q3d.export_equivalent_circuit(
file_name=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model_name="test"
)
output_file=os.path.join(self.local_scratch.path, "test_export_circuit.cir"), model="test")
self.aedtapp.close_project(q3d.project_name, save_project=False)

def test_17_export_results_q3d(self, add_app):
Expand Down
2 changes: 1 addition & 1 deletion doc/source/API/SetupTemplatesIcepak.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can edit a setup after it is created. Here is an example:
# Any property of this setup can be found on this page.
setup = app.create_setup(MaxIterations=5)
Available turbulent models are: ``"ZeroEquation"``, ``"TwoEquation"``, ``"EnhancedTwoEquation"``, ``"RNG"``, ``"EnhancedRNG"``, ``"RealizableTwoEquation"``, ``"EnhancedRealizableTwoEquation"``, ``"SpalartAllmaras"``, ``"kOmegaSST"``.

.. pprint:: pyaedt.modules.SetupTemplates.TransientFlowOnly
.. pprint:: pyaedt.modules.SetupTemplates.TransientTemperatureOnly
Expand Down
19 changes: 7 additions & 12 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ PyAEDT documentation |version|
`Source Repository <https://github.com/ansys/pyaedt>`_ |
`Issues <https://github.com/ansys/pyaedt/issues>`_

PyAEDT is a Python library that interacts directly with the Ansys Electronics Desktop (AEDT) API,
PyAEDT is a Python client library that interacts directly with the Ansys Electronics Desktop (AEDT) API,
enabling straightforward and efficient automation in your workflow.

.. note::
Also consider viewing the `PyEDB documentation <https://edb.docs.pyansys.com/version/stable/>`_.
PyEDB is a Python client library for processing complex and large layout designs in the Ansys
Electronics Database (EDB) format, which stores information describing designs for AEDT.

.. grid:: 2

Expand All @@ -26,19 +30,12 @@ enabling straightforward and efficient automation in your workflow.

.. grid:: 2

.. grid-item-card:: AEDT API reference :fa:`book-bookmark`
.. grid-item-card:: API reference :fa:`book-bookmark`
:link: API/index
:link-type: doc

This section contains descriptions of the functions and modules included in PyAEDT.
It describes how the methods work and the parameter that can be used.

.. grid-item-card:: EDB API reference :fa:`book-bookmark`
:link: https://edb.docs.pyansys.com/version/stable/
:link-type: url

Contains descriptions of the functions and modules included in PyEDB.
It describes how the methods work and the parameter that can be used.
It describes how the methods work and the parameters that can be used.

.. jinja:: main_toctree

Expand Down Expand Up @@ -70,5 +67,3 @@ enabling straightforward and efficient automation in your workflow.
{% if run_examples %}
examples/index
{% endif %}


9 changes: 7 additions & 2 deletions examples/01-HFSS3DLayout/Hfss3DComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@
h3d["len"] = str(trace_length) + "mm"
h3d["w1"] = str(trace_width) + "mm"

h3d.create_edge_port(line, h3d.modeler[line].top_edge_x, is_wave_port=True, wave_horizontal_extension=15)
line = h3d.modeler.create_line("L1", [[0, 0], ["len", 0]], lw="w1", name="microstrip", net="microstrip")
h3d.create_edge_port(line, h3d.modeler[line.name].top_edge_x, is_wave_port=True, wave_horizontal_extension=15)

###############################################################################
# Create void on Ground plane for pin
Expand All @@ -218,7 +218,12 @@
h3d.edit_hfss_extents(diel_extent_horizontal_padding="0.2", air_vertical_positive_padding="0",
air_vertical_negative_padding="2", airbox_values_as_dim=False)
setup1 = h3d.create_setup()
sweep1 = h3d.create_linear_count_sweep(setup1.name, "GHz", 0.01, 8, 1601, sweep_type="Interpolating")
sweep1 = h3d.create_linear_count_sweep(setup1.name,
"GHz",
0.01,
8,
1601,
sweep_type="Interpolating")
setup1.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"]["AdaptiveFrequency"] = freq
setup1.props["AdaptiveSettings"]["SingleFrequencyDataList"]["AdaptiveFrequencyData"]["MaxPasses"] = max_steps

Expand Down
7 changes: 0 additions & 7 deletions examples/03-Maxwell/Maxwell2D_Electrostatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@

M2D.post.export_field_plot(plot_name="LineTracesTest", output_dir=M2D.toolkit_directory, file_format="fldplt")

##########################################################
# Export a field plot to an image file
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Export the flux lines plot to an image file using PyVista Python package.

M2D.post.plot_field_from_fieldplot(plot.name, show=False)

##########################################################
# Export the mesh field plot
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 3 additions & 1 deletion examples/05-Q3D/Q3D_DC_IR.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@
# ~~~~~~~~
# Compute ACL solutions and plot them.

plot1 = q3d.post.create_fieldplot_surface(q3d.modeler.get_objects_by_material("copper"), quantity=drop_name)
plot1 = q3d.post.create_fieldplot_surface(q3d.modeler.get_objects_by_material("copper"),
quantity=drop_name,
intrinsics={"Freq": "1GHz"})

q3d.post.plot_field_from_fieldplot(plot1.name, project_path=q3d.working_directory, mesh_plot=False, image_format="jpg",
view="isometric", show=False, plot_cad_objs=False, log_scale=False)
Expand Down
3 changes: 1 addition & 2 deletions examples/07-TwinBuilder/02-Wiring_A_Rectifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@

tb.analyze_setup("TR")


###############################################################################
# Get report data and plot using Matplotlib
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -136,7 +135,7 @@
x = tb.post.get_solution_data(E_Value, "TR", "Time")
plt.plot(x.intrinsics["Time"], x.data_real(E_Value))

R_Value = "RL.V"
R_Value = "R1.V"
x = tb.post.get_solution_data(R_Value, "TR", "Time")
plt.plot(x.intrinsics["Time"], x.data_real(R_Value))

Expand Down
10 changes: 6 additions & 4 deletions pyaedt/application/design_solutions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy

from pyaedt.aedt_logger import pyaedt_logger as logger
from pyaedt.generic.general_methods import pyaedt_function_handler

solutions_defaults = {
Expand Down Expand Up @@ -549,7 +550,8 @@ def __init__(self, odesign, design_type, aedt_version):
self._odesign = odesign
self._aedt_version = aedt_version
self.model_name = model_names[design_type]
assert design_type in solutions_types, "Wrong Design Type"
if not design_type in solutions_types:
raise ValueError("Design type is not valid.")
# deepcopy doesn't work on remote
self._solution_options = copy.deepcopy(solutions_types[design_type])
self._design_type = design_type
Expand Down Expand Up @@ -844,7 +846,7 @@ def solution_type(self, value):
opts = ""
self._odesign.SetSolutionType(self._solution_options[self._solution_type]["name"], opts)
except Exception:
pass
logger.error("Failed to set solution type.")


class IcepakDesignSolution(DesignSolution, object):
Expand Down Expand Up @@ -922,7 +924,7 @@ def solution_type(self, solution_type):
try:
self._odesign.SetSolutionType(options)
except Exception:
pass
logger.error("Failed to set solution type.")


class RmXprtDesignSolution(DesignSolution, object):
Expand All @@ -943,7 +945,7 @@ def solution_type(self, solution_type):
self._odesign.SetDesignFlow(self._design_type, solution_type)
self._solution_type = solution_type
except Exception:
pass
logger.error("Failed to set design flow.")

@property
def design_type(self):
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def create_schematic_from_netlist(self, input_file):
self[ppar] = pval
xpos = 0.0254
except Exception:
pass
self.logger.error("Failed to parse line '{}'.".format(line))
elif ".model" in line[:7].lower() or ".lib" in line[:4].lower():
model.append(line)
if model:
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/generic/general_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def deprecate_kwargs(func_name, kwargs, aliases):
msg += "{} is deprecated, use {} instead.".format(alias, new)
raise TypeError(msg)
pyaedt_logger.warning(
'`{}` is deprecated as an argument to `{}`; use" f" `{}` instead.'.format(alias, func_name, new)
"Argument `{}` is deprecated for method `{}`; use `{}` instead.".format(alias, func_name, new)
)
kwargs[new] = kwargs.pop(alias)

Expand Down
Loading

0 comments on commit a424ea6

Please sign in to comment.