.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\02-HFSS\Probe_Fed_Patch.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_02-HFSS_Probe_Fed_Patch.py: HFSS: Probe-fed patch antenna --------------------------------------------------------- This example shows how to use the ``Stackup3D`` class to create and analyze a patch antenna in HFSS. Note that the HFSS 3D Layout interface may offer advantages for laminate structures such as the patch antenna. .. GENERATED FROM PYTHON SOURCE LINES 12-14 Perform imports ~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 14-21 .. code-block:: default import os import pyaedt import tempfile from pyaedt.modeler.advanced_cad.stackup_3d import Stackup3D .. GENERATED FROM PYTHON SOURCE LINES 22-31 Set non-graphical mode ~~~~~~~~~~~~~~~~~~~~~~ Set non-graphical mode. ``"PYAEDT_NON_GRAPHICAL"`` is set to ``False`` to create this documentation. You can set ``non_graphical`` to ``True`` to view HFSS while the notebook cells are executed. Use the 2023R2 release of HFSS. .. GENERATED FROM PYTHON SOURCE LINES 31-37 .. code-block:: default non_graphical = True # Set to False to launch the AEDT UI. desktop_version = "2023.2" length_units = "mm" freq_units = "GHz" .. GENERATED FROM PYTHON SOURCE LINES 38-46 Create temporary working folder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Use tempfile to create a temporary working folder. Project data is deleted after this example is run. To save the project data in another location, change the location of the project directory. .. GENERATED FROM PYTHON SOURCE LINES 46-54 .. code-block:: default # tmpdir.cleanup() at the end of this notebook removes all # project files and data. tmpdir = tempfile.TemporaryDirectory(suffix="_aedt") project_folder = tmpdir.name proj_name = os.path.join(project_folder, "antenna") .. GENERATED FROM PYTHON SOURCE LINES 55-58 Launch HFSS ----------- .. GENERATED FROM PYTHON SOURCE LINES 58-67 .. code-block:: default hfss = pyaedt.Hfss(projectname=proj_name, solution_type="Terminal", designname="patch", non_graphical=non_graphical, specified_version=desktop_version) hfss.modeler.model_units = length_units .. rst-class:: sphx-glr-script-out .. code-block:: none Initializing new desktop! .. GENERATED FROM PYTHON SOURCE LINES 68-72 Create patch ------------ Create the patch. .. GENERATED FROM PYTHON SOURCE LINES 72-99 .. code-block:: default stackup = Stackup3D(hfss) ground = stackup.add_ground_layer("ground", material="copper", thickness=0.035, fill_material="air") dielectric = stackup.add_dielectric_layer("dielectric", thickness="0.5" + length_units, material="Duroid (tm)") signal = stackup.add_signal_layer("signal", material="copper", thickness=0.035, fill_material="air") patch = signal.add_patch(patch_length=9.57, patch_width=9.25, patch_name="Patch", frequency=1E10) stackup.resize_around_element(patch) pad_length = [3, 3, 3, 3, 3, 3] # Air bounding box buffer in mm. region = hfss.modeler.create_region(pad_length, is_percentage=False) hfss.assign_radiation_boundary_to_objects(region) patch.create_probe_port(ground, rel_x_offset=0.485) setup = hfss.create_setup(setupname="Setup1", setuptype="HFSSDriven", Frequency="10GHz") setup.create_frequency_sweep(unit="GHz", sweepname="Sweep1", freqstart=8, freqstop=12, sweep_type="Interpolating") hfss.save_project() hfss.analyze() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 100-102 Plot S11 --------- .. GENERATED FROM PYTHON SOURCE LINES 102-108 .. code-block:: default plot_data = hfss.get_traces_for_plot() report = hfss.post.create_report(plot_data) solution = report.get_solution_data() plt = solution.plot(solution.expressions) .. image-sg:: /examples/02-HFSS/images/sphx_glr_Probe_Fed_Patch_001.png :alt: Simulation Results Plot :srcset: /examples/02-HFSS/images/sphx_glr_Probe_Fed_Patch_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 109-112 Release AEDT ------------ Release AEDT and clean up temporary folders and files. .. GENERATED FROM PYTHON SOURCE LINES 112-114 .. code-block:: default hfss.release_desktop() tmpdir.cleanup() .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 52.160 seconds) .. _sphx_glr_download_examples_02-HFSS_Probe_Fed_Patch.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Probe_Fed_Patch.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Probe_Fed_Patch.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_