Skip to content

Commit

Permalink
Merge branch 'main' into release/0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys committed Mar 22, 2024
2 parents ca9eff6 + 8e54f81 commit 4cf0fde
Show file tree
Hide file tree
Showing 57 changed files with 3,040 additions and 1,715 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cpython_linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Linux_CPython_UnitTests

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
python.version: '3.10'
python.venv: 'testvenv'
# Following env vars when changed will "reset" the mentioned cache,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/full_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name: FullDocumentation

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
python.version: '3.10'
python.venv: 'testvenv'
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ironpython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

name: CI_Ironpython

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}

# Controls when the workflow will run
on:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- cron: '0 4 * * *'

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
DOCUMENTATION_CNAME: 'aedt.docs.pyansys.com'
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }}
Expand Down Expand Up @@ -39,7 +40,7 @@ jobs:
make -C doc phtml
- name: Upload documentation HTML artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: doc/_build/html
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI

env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
python.version: '3.10'
python.venv: 'testvenv'
# Following env vars when changed will "reset" the mentioned cache,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheelhouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
retention-days: 7

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
generate_release_notes: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheelhouse_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
retention-days: 7

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
generate_release_notes: true
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude: |
repos:
- repo: https://github.com/psf/black
rev: 24.2.0 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
rev: 24.3.0 # IF VERSION CHANGES --> MODIFY "blacken-docs" MANUALLY AS WELL!!
hooks:
- id: black
args:
Expand Down Expand Up @@ -56,7 +56,7 @@ repos:
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==24.2.0]
additional_dependencies: [black==24.3.0]


# - repo: https://github.com/numpy/numpydoc
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You can install PyAEDT on CPython 3.7 through 3.10 from PyPI with this command:
Install PyAEDT with all extra packages (matplotlib, numpy, pandas, pyvista):

```sh
pip install pyaedt[full]
pip install pyaedt[all]
```

You can also install PyAEDT from Conda-Forge with this command:
Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
```
4. 如果你需要其他库来做后期处理,可以使用以下方法来安装它们:
```sh
pip install pyaedt[full]
pip install pyaedt[all]
```

## 关于 PyAEDT
Expand Down
2 changes: 1 addition & 1 deletion _unittest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
desktop_version = config["desktopVersion"]
new_thread = config["NewThread"]
settings.use_grpc_api = config["use_grpc"]

settings.objects_lazy_load = False
logger = pyaedt_logger


Expand Down
2 changes: 1 addition & 1 deletion _unittest/test_01_Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def test_33_aedt_object(self):
aedt_obj = AedtObjects()
assert aedt_obj.odesign
assert aedt_obj.oproject
aedt_obj = AedtObjects(self.aedtapp.oproject, self.aedtapp.odesign)
aedt_obj = AedtObjects(self.aedtapp._desktop_class, self.aedtapp.oproject, self.aedtapp.odesign)
assert aedt_obj.odesign == self.aedtapp.odesign

def test_34_force_project_path_disable(self):
Expand Down
6 changes: 6 additions & 0 deletions _unittest/test_07_Object3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,12 @@ def test_26_unclassified_object(self):
self.aedtapp.modeler.oeditor.Intersect(vArg1, vArg2)
assert box1 in self.aedtapp.modeler.unclassified_objects

def test_26a_delete_unclassified_object(self):
unclassified = self.aedtapp.modeler.unclassified_objects
assert self.aedtapp.modeler.delete(unclassified)
assert len(self.aedtapp.modeler.unclassified_objects) != unclassified
assert len(self.aedtapp.modeler.unclassified_objects) == 0

def test_27_get_object_history_properties(self):
box = self.aedtapp.modeler.create_box([10, 10, 10], [15, 15, 15], "box_history", matname="Copper")
cylinder = self.aedtapp.modeler.create_cylinder(
Expand Down
29 changes: 28 additions & 1 deletion _unittest/test_09_Primitives2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ def aedtapp(add_app):
return app


@pytest.fixture(scope="class")
def axisymmetrical(add_app):
app = add_app(design_name="2D_Primitives_3", solution_type="TransientZ", application=Maxwell2d)
return app


class TestClass:
@pytest.fixture(autouse=True)
def init(self, aedtapp, local_scratch):
def init(self, aedtapp, axisymmetrical, local_scratch):
self.aedtapp = aedtapp
self.axisymmetrical = axisymmetrical
self.local_scratch = local_scratch

def create_rectangle(self, name=None):
Expand Down Expand Up @@ -74,6 +81,26 @@ def test_06_create_region(self):
region = self.aedtapp.modeler.create_region([100, 100, 100, 100, 100, 100])
assert not region

def test_06_a_create_region_Z(self):
if self.axisymmetrical.modeler["Region"]:
self.axisymmetrical.modeler.delete("Region")
assert "Region" not in self.axisymmetrical.modeler.object_names
assert not self.axisymmetrical.modeler.create_region(["100%", "50%", "20%"])
assert self.axisymmetrical.modeler.create_region([100, 50, 20])
self.axisymmetrical.modeler["Region"].delete()
assert self.axisymmetrical.modeler.create_region(100)
self.axisymmetrical.modeler["Region"].delete()
assert self.axisymmetrical.modeler.create_region("200")
self.axisymmetrical.modeler["Region"].delete()
assert self.axisymmetrical.modeler.create_region([100, "50mm", 20], False)
self.axisymmetrical.modeler["Region"].delete()
assert self.axisymmetrical.modeler.create_region([100, "50mm", "100"], False)
self.axisymmetrical.modeler["Region"].delete()
assert self.axisymmetrical.modeler.create_region(["50mm", "50mm", "50mm"], False)
self.axisymmetrical.modeler["Region"].delete()
assert self.axisymmetrical.modeler.create_region("10mm", False)
self.axisymmetrical.modeler["Region"].delete()

def test_07_assign_material_ceramic(self, material="Ceramic_material"):
self.aedtapp.assign_material(["Rectangle1"], material)
assert self.aedtapp.modeler["Rectangle1"].material_name == material
Expand Down
8 changes: 6 additions & 2 deletions _unittest/test_11_Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def init(self, aedtapp, local_scratch):
def test_01_create_hfss_setup(self):
setup1 = self.aedtapp.create_setup("My_HFSS_Setup", self.aedtapp.SETUPS.HFSSDrivenDefault)
assert setup1.name == "My_HFSS_Setup"
assert self.aedtapp.setups[0].name == setup1.name
assert "SaveRadFieldsOnly" in setup1.props
assert "SaveRadFieldsOnly" in setup1.available_properties
setup1["SaveRadFieldsonly"] = True
Expand Down Expand Up @@ -67,6 +68,8 @@ def test_01c_create_hfss_setup_auto_open(self):
self.aedtapp.duplicate_design("auto_open")
for setup in self.aedtapp.get_setups():
self.aedtapp.delete_setup(setup)
assert setup not in self.aedtapp.setups
assert not self.aedtapp.setups
self.aedtapp.set_auto_open()
setup1 = self.aedtapp.get_setup("Auto1")
setup1.enable_adaptive_setup_multifrequency([1.9, 2.4], 0.02)
Expand All @@ -79,8 +82,9 @@ def test_02_create_circuit_setup(self):
assert setup1.name == "circuit"
setup1.props["SweepDefinition"]["Data"] = "LINC 0GHz 4GHz 501"
setup1["SaveRadFieldsonly"] = True
setup1["SweepDefinition/Data"] = "LINC 0GHz 4GHz 301"
assert setup1.props["SweepDefinition"]["Data"] == "LINC 0GHz 4GHz 301"
setup1["SweepDefinition/Data"] = "LINC 0GHz 4GHz 302"
assert setup1.props["SweepDefinition"]["Data"] == "LINC 0GHz 4GHz 302"
assert circuit.setups[0].props["SweepDefinition"]["Data"] == "LINC 0GHz 4GHz 302"
assert "SweepDefinition" in setup1.available_properties
setup1.update()
setup1.disable()
Expand Down
68 changes: 66 additions & 2 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from pyaedt.modules.SetupTemplates import SetupKeys

test_subfolder = "T98"

if config["desktopVersion"] > "2022.2":
test_project_name = "Filter_Board_Icepak_231"
src_project_name = "USB_Connector_IPK_231"
Expand Down Expand Up @@ -1484,6 +1483,71 @@ def test_73_conducting_plate(self):
with pytest.raises(AttributeError):
self.aedtapp.assign_conducting_plate_with_conductance([box_face.id, "surfPlateTest"])

def test_74_native_component_load(self, add_app):
def test_74_boundary_conditions_dictionaries(self):
box1 = self.aedtapp.modeler.create_box([5, 5, 5], [1, 2, 3])
ds_temp = self.aedtapp.create_dataset(
"ds_temp3", [1, 2, 3], [3, 2, 1], is_project_dataset=False, xunit="cel", yunit="W"
)
bc1 = self.aedtapp.create_temp_dep_assignment(ds_temp.name)
assert bc1
assert bc1.dataset_name == "ds_temp3"
assert self.aedtapp.assign_solid_block(box1.name, bc1)

self.aedtapp.solution_type = "Transient"

ds_time = self.aedtapp.create_dataset(
"ds_time3", [1, 2, 3], [3, 2, 1], is_project_dataset=False, xunit="s", yunit="W"
)
bc2 = self.aedtapp.create_dataset_transient_assignment(ds_time.name)
rect = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [0, 0, 0], [20, 10])
assert bc2
assert self.aedtapp.assign_conducting_plate_with_resistance(rect.name, total_power=bc2)

cylinder = self.aedtapp.modeler.create_cylinder(0, [-10, -10, -10], 1, 50)
bc3 = self.aedtapp.create_sinusoidal_transient_assignment("1W", "3", "2", "0.5s")
assert bc3
assert self.aedtapp.assign_solid_block(cylinder.name, bc3)

bc4 = self.aedtapp.create_square_wave_transient_assignment("3m_per_sec", "0.5s", "3s", "1s", "0.5m_per_sec")
assert bc4
assert self.aedtapp.assign_free_opening(
self.aedtapp.modeler["Region"].faces[0].id, flow_type="Velocity", velocity=[bc4, 0, 0]
)

bondwire = self.aedtapp.modeler.create_bondwire([0, 0, 0], [1, 2, 3])
bc5 = self.aedtapp.create_linear_transient_assignment("0.01W", "5")
assert bc5
assert self.aedtapp.assign_solid_block(bondwire.name, bc5)

box2 = self.aedtapp.modeler.create_box([15, 15, 15], [1, 2, 3])
bc6 = self.aedtapp.create_exponential_transient_assignment("0W", "4", "2")
assert bc6
assert self.aedtapp.assign_power_law_resistance(
box2.name,
total_power=bc6,
power_law_constant=1.5,
power_law_exponent="3",
)

box = self.aedtapp.modeler.create_box([25, 25, 25], [1, 2, 3])
box.solve_inside = False
bc7 = self.aedtapp.create_powerlaw_transient_assignment("0.5kg_per_s", "10", "0.3")
assert bc7
assert self.aedtapp.assign_recirculation_opening(
[box.top_face_x.id, box.bottom_face_x.id],
box.top_face_x.id,
assignment_value=bc6,
flow_assignment=bc7,
start_time="0s",
end_time="10s",
)

ds1_temp = self.aedtapp.create_dataset(
"ds_temp3", [1, 2, 3], [3, 2, 1], is_project_dataset=True, xunit="cel", yunit="W"
)
assert not self.aedtapp.create_temp_dep_assignment(ds1_temp.name)
assert not self.aedtapp.create_temp_dep_assignment("nods")

def test_75_native_component_load(self, add_app):
app = add_app(application=Icepak, project_name=native_import, subfolder=test_subfolder)
assert len(app.native_components) == 1
Loading

0 comments on commit 4cf0fde

Please sign in to comment.