Note
Click here to download the full example code
HFSS: spiral inductor#
This example shows how you can use PyAEDT to create a spiral inductor, solve it, and plot results.
Perform required imports#
Perform required imports.
import os
import pyaedt
project_name = pyaedt.generate_unique_project_name(project_name="spiral")
Set non-graphical mode#
Set non-graphical mode. "PYAEDT_NON_GRAPHICAL"
is needed to generate
documentation only.
You can set non_graphical
either to True
or False
.
non_graphical = os.getenv("PYAEDT_NON_GRAPHICAL", "False").lower() in ("true", "1", "t")
Launch HFSS#
Launch HFSS 2022 R2 in non-graphical mode and change the units to microns.
hfss = pyaedt.Hfss(specified_version="2022.2", non_graphical=non_graphical, designname="A1")
hfss.modeler.model_units = "um"
p = hfss.modeler
Define variables#
Define input variables. You can use the values that follow or edit them.
Standardize polyline#
Standardize the polyline using the create_line
method to fix
the width, thickness, and material.
Create spiral inductor#
Create the spiral inductor. This spiral inductor is not parametric, but you could parametrize it later.
Center return path#
Center the return path.
<pyaedt.modeler.cad.object3d.Object3d object at 0x0000028BF4FC5DF0>
Create port 1#
Create port 1.
p.create_rectangle(csPlane=pyaedt.constants.PLANE.YZ,
position=(abs(x1) + 5, y0 - width / 2, -gap - thickness / 2),
dimension_list=(width, -Tsub + gap),
name="port1"
)
hfss.create_lumped_port_to_sheet(sheet_name="port1", axisdir=pyaedt.constants.AXIS.Z)
<pyaedt.modules.Boundary.BoundaryObject object at 0x0000028BEC0F6520>
Create port 2#
Create port 2.
<pyaedt.modules.Boundary.BoundaryObject object at 0x0000028BEC45B130>
Create silicon substrate and ground plane#
Create the silicon substrate and the ground plane.
<pyaedt.modeler.cad.object3d.Object3d object at 0x0000028BEBD0EB80>
Assign airbox and radiation#
Assign the airbox and the radiation.
<pyaedt.modules.Boundary.BoundaryObject object at 0x0000028BF4DC1070>
Assign material override#
Assign a material override so that the validation check does not fail.
hfss.change_material_override()
True
Plot model#
Plot the model.
hfss.plot(show=False, export_path=os.path.join(hfss.working_directory, "Image.jpg"), plot_air_objects=False)

<pyaedt.generic.plot.ModelPlotter object at 0x0000028BEC0F6820>
Create setup#
Create the setup and define a frequency sweep to solve the project.
setup1 = hfss.create_setup(setupname="setup1")
setup1.props["Frequency"] = "10GHz"
hfss.create_linear_count_sweep(setupname="setup1", unit="GHz", freqstart=1e-3, freqstop=50, num_of_freq_points=451,
sweep_type="Interpolating")
hfss.save_project()
hfss.analyze_all()
True
Get report data#
Get report data and use the following formulas to calculate the inductance and quality factor.
Plot calculated values in Matplotlib#
Plot the calculated values in Matplotlib.

<Figure size 2000x1000 with 1 Axes>
Save project and close AEDT#
Save the project and close AEDT.
hfss.save_project(project_name)
hfss.release_desktop()
True
Total running time of the script: ( 1 minutes 46.111 seconds)