Skip to content

FIX: Change units in non linear properties #6130

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 2 commits into from
May 8, 2025
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
1 change: 1 addition & 0 deletions doc/changelog.d/6130.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change units in non linear properties
14 changes: 7 additions & 7 deletions src/ansys/aedt/core/modules/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
def value(self, val):
if isinstance(val, list) and isinstance(val[0], list):
self._property_value[0].value = val
self._set_non_linear()
self.set_non_linear()
elif isinstance(val, list) and self.type != "vector":
if len(val) == 3:
self.type = "anisotropic"
Expand Down Expand Up @@ -929,7 +929,7 @@
return self._material.update()

@pyaedt_function_handler()
def _set_non_linear(self, x_unit=None, y_unit=None):
def set_non_linear(self, x_unit=None, y_unit=None):
"""Enable non-linear material.

This is a private method, and should not be used directly.
Expand Down Expand Up @@ -963,12 +963,12 @@
return False
self.type = "nonlinear"
if self.name == "permeability":
if not x_unit:
x_unit = "tesla"
if not y_unit:
y_unit = "A_per_meter"
self.bunit = x_unit
self.hunit = y_unit
y_unit = "tesla"
if not y_unit:
x_unit = "A_per_meter"

Check warning on line 969 in src/ansys/aedt/core/modules/material.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/modules/material.py#L969

Added line #L969 was not covered by tests
self.bunit = y_unit
self.hunit = x_unit
self.is_temperature_dependent = False
self.btype_for_single_curve = "normal"
self.temperatures = {}
Expand Down
1 change: 1 addition & 0 deletions tests/system/general/test_03_Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def test_09_non_linear_materials(self, add_app):
app = add_app(application=Maxwell3d, solution_type="Transient")
mat1 = app.materials.add_material("myMat")
mat1.permeability = [[0, 0], [1, 12], [10, 30]]
mat1.permeability.set_non_linear(x_unit="Oe", y_unit="gauss")
mat1.permittivity = [[0, 0], [2, 12], [10, 30]]
mat1.conductivity.value = [[0, 0], [3, 12], [10, 30]]
app.materials.export_materials_to_file(os.path.join(self.local_scratch.path, "non_linear.json"))
Expand Down
Loading