Skip to content

Commit

Permalink
FIX: HFSS Setup error #5618 (#5619)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxime Rey <[email protected]>
Co-authored-by: Samuelopez-ansys <[email protected]>
  • Loading branch information
4 people authored Jan 14, 2025
1 parent d396cae commit 8d696d9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
7 changes: 3 additions & 4 deletions src/ansys/aedt/core/hfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,10 @@ def create_setup(self, name="MySetupAuto", setup_type=None, **kwargs):
Name of the setup. The default is ``"Setup1"``.
setup_type : str, optional
Type of the setup, which is based on the solution type. Options are
``"HFSSDrivenAuto"``, ``"HFSSDrivenDefault"``, ``"HFSSEigen"``, ``"HFSSTransient"``,
and ``"HFSSSBR"``. The default is ``"HFSSDrivenAuto"``.
``"HFSSDrivenAuto"``, ``"HFSSDriven"``, ``"HFSSEigen"``, ``"HFSSTransient"``,
and ``"HFSSSBR"``. The default is ``"HFSSDriven"``.
**kwargs : dict, optional
Extra arguments to set up the circuit.
Available keys depend on the setup chosen.
Keyword arguments from the native AEDT API.
For more information, see
:doc:`../SetupTemplatesHFSS`.
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/modules/setup_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def HFSS3DLayout_AdaptiveFrequencyData(freq):


meshlink = dict({"ImportMesh": False})
autosweep = dict({"RangeType": "LinearStep", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeStep": "1GHz"})
autosweep = dict({"RangeType": "LinearCount", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeCount": "501"})
autosweeps = dict({"Sweep": autosweep})
multifreq = dict({"1GHz": [0.02], "2GHz": [0.02], "5GHz": [0.02]})
sweepsbr = dict({"RangeType": "LinearStep", "RangeStart": "1GHz", "RangeEnd": "10GHz", "RangeStep": "1GHz"})
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/workflows/hfss/choke_designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def main(extension_args):
hfss.modeler.create_region(pad_percent=1000)

# Create setup
setup = hfss.create_setup("Setup1")
setup = hfss.create_setup("Setup1", setup_type="HFSSDriven")
setup.props["Frequency"] = "50MHz"
setup.props["MaximumPasses"] = 10

Expand Down
6 changes: 5 additions & 1 deletion tests/system/general/test_20_HFSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ def test_01_save(self):
assert os.path.exists(test_project)

def test_01A_check_setup(self):
assert self.aedtapp.active_setup is None
setup_auto = self.aedtapp.create_setup(name="auto", setup_type="HFSSDrivenAuto")
assert self.aedtapp.setups[0].name == "auto"
assert setup_auto.properties["Auto Solver Setting"] == "Balanced"
assert setup_auto.properties["Type"] == "Discrete"
assert setup_auto.delete()

def test_02_create_primitive(self):
coax1_len = 200
Expand Down
17 changes: 11 additions & 6 deletions tests/system/solvers/test_00_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ def test_02_hfss_export_results(self, hfss_app):
hfss_app.add_3d_component_array_from_json(dict_in)
exported_files = hfss_app.export_results()
assert len(exported_files) == 0
setup = hfss_app.create_setup(name="test")
setup.props["Frequency"] = "1GHz"
setup_driven = hfss_app.create_setup(name="test", setup_type="HFSSDriven", MaximumPasses=1)
exported_files = hfss_app.export_results()
solve_freq = setup_driven.props["Frequency"]
assert len(exported_files) == 0
hfss_app.analyze_setup(name="test", cores=4)
assert setup_driven.is_solved
exported_files = hfss_app.export_results()
assert len(exported_files) == 39
exported_files = hfss_app.export_results(
Expand All @@ -215,25 +216,29 @@ def test_02_hfss_export_results(self, hfss_app):
assert len(exported_files) > 0
fld_file1 = os.path.join(self.local_scratch.path, "test_fld_hfss1.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E", output_file=fld_file1, assignment="Box1", intrinsics="1GHz", phase="5deg"
quantity="Mag_E", output_file=fld_file1, assignment="Box1", intrinsics=solve_freq, phase="5deg"
)
assert os.path.exists(fld_file1)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss2.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E", output_file=fld_file2, assignment="Box1", intrinsics={"frequency": "1GHz"}
quantity="Mag_E", output_file=fld_file2, assignment="Box1", intrinsics={"frequency": solve_freq}
)
assert os.path.exists(fld_file2)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss3.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E",
output_file=fld_file2,
assignment="Box1",
intrinsics={"frequency": "1GHz", "phase": "30deg"},
intrinsics={"frequency": solve_freq, "phase": "30deg"},
)
assert os.path.exists(fld_file2)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss4.fld")
assert hfss_app.post.export_field_file(
quantity="Mag_E", output_file=fld_file2, assignment="Box1", intrinsics={"frequency": "1GHz"}, phase="30deg"
quantity="Mag_E",
output_file=fld_file2,
assignment="Box1",
intrinsics={"frequency": solve_freq},
phase="30deg",
)
assert os.path.exists(fld_file2)
fld_file2 = os.path.join(self.local_scratch.path, "test_fld_hfss5.fld")
Expand Down

0 comments on commit 8d696d9

Please sign in to comment.