Skip to content

Add unit tests for setup from different analysis. #889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Setup paths for module imports
from _unittest.conftest import scratch_path, local_path
import os
import tempfile

# Import required modules
from pyaedt import Maxwell3d
Expand Down Expand Up @@ -99,6 +100,20 @@ def test_07_setup(self):
assert Setup.enable()
assert self.aedtapp.setup_ctrlprog(Setup.name)

def test_08_setup_ctrlprog_with_file(self):
transient_setup = self.aedtapp.create_setup()
transient_setup.props["MaximumPasses"] = 12
transient_setup.props["MinimumPasses"] = 2
transient_setup.props["MinimumConvergedPasses"] = 1
transient_setup.props["PercentRefinement"] = 30
transient_setup.props["Frequency"] = "200Hz"
transient_setup.update()
transient_setup.enable_expression_cache(["CoreLoss"], "Fields", "Phase='0deg' ", True)

# Test the creation of the control program file
with tempfile.TemporaryFile("w+") as fp:
assert self.aedtapp.setup_ctrlprog(transient_setup.name, file_str=fp.name)

def test_22_create_length_mesh(self):
assert self.aedtapp.mesh.assign_length_mesh(["Plate"])

Expand Down
4 changes: 4 additions & 0 deletions _unittest/test_29_Mechanical.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def test_07_assign_mechanical_boundaries(self):
assert mech.assign_fixed_support(mech.modeler["MyCylinder"].faces[0].id)
assert mech.assign_frictionless_support(mech.modeler["MyCylinder"].faces[1].id)

mech = Mechanical(solution_type=self.aedtapp.SOLUTIONS.Mechanical.Thermal)
assert not mech.assign_fixed_support(mech.modeler["MyCylinder"].faces[0].id)
assert not mech.assign_frictionless_support(mech.modeler["MyCylinder"].faces[0].id)

def test_08_mesh_settings(self):
assert self.aedtapp.mesh.initial_mesh_settings
assert self.aedtapp.mesh.initial_mesh_settings.props
3 changes: 3 additions & 0 deletions _unittest/test_31_Q3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def test_06a_create_setup(self):
assert sweep
assert sweep.props["RangeStart"] == "1GHz"

# Create a discrete sweep with the same name of an existing sweep is not possible.
assert not self.aedtapp.create_discrete_sweep(mysetup.name, sweepname="mysweep", freqstart=1, units="GHz")

def test_06b_create_setup(self):
mysetup = self.aedtapp.create_setup()
mysetup.props["SaveFields"] = True
Expand Down
17 changes: 17 additions & 0 deletions _unittest/test_41_3dlayout_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,23 @@ def test_18b_create_linear_step_sweep(self):
)
assert sweep4.props["Sweeps"]["Data"] == "LIN 1GHz 10GHz 0.12GHz"

# Create a linear step sweep with the incorrect sweep type.
try:
sweep_raising_error = self.aedtapp.create_linear_step_sweep(
setupname=setup_name,
unit="GHz",
freqstart=1,
freqstop=10,
step_size=0.12,
sweepname="RFBoardSweep4",
sweep_type="Incorrect",
save_fields=True,
)
except AttributeError as e:
exception_raised = True
assert e.args[0] == "Invalid in `sweep_type`. It has to be either 'Discrete', 'Interpolating', or 'Fast'"
assert exception_raised

def test_18c_create_single_point_sweep(self):
setup_name = "RFBoardSetup"
sweep5 = self.aedtapp.create_single_point_sweep(
Expand Down