Skip to content
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

FIX: Separation of faces and objects in assign voltage method #5010

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
4 changes: 4 additions & 0 deletions _unittest/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,16 @@ def test_32_matrix(self, add_app):
rectangle2 = m3d.modeler.create_rectangle(0, [9, 1.5, 0], [2.5, 5], name="Sheet2")
rectangle3 = m3d.modeler.create_rectangle(0, [16.5, 1.5, 0], [2.5, 5], name="Sheet3")
rectangle4 = m3d.modeler.create_rectangle(0, [32.5, 1.5, 0], [2.5, 5], name="Sheet4")
box1 = m3d.modeler.create_box([0, 0, 0], [10, 10, 5], "MyBox1")
box2 = m3d.modeler.create_box([10, 10, 10], [10, 10, 5], "MyBox2")

m3d.assign_voltage(rectangle1.faces[0], amplitude=1, name="Voltage1")
m3d.assign_voltage("Sheet1", amplitude=1, name="Voltage5")
m3d.assign_voltage(rectangle2.faces[0], amplitude=1, name="Voltage2")
m3d.assign_voltage(rectangle3.faces[0], amplitude=1, name="Voltage3")
m3d.assign_voltage(rectangle4.faces[0], amplitude=1, name="Voltage4")
m3d.assign_voltage(box1.faces, amplitude=1, name="Voltage6")
m3d.assign_voltage(box2, amplitude=1, name="Voltage7")

L = m3d.assign_matrix(assignment="Voltage1")
assert L.props["MatrixEntry"]["MatrixEntry"][0]["Source"] == "Voltage1"
Expand Down
8 changes: 7 additions & 1 deletion pyaedt/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,13 @@
else:
props = OrderedDict({"Faces": assignment, "Value": amplitude})
else:
props = OrderedDict({"Faces": assignment, "Voltage": amplitude})
object_names_set = set(self.modeler.object_names)
props = OrderedDict({"Faces": [], "Objects": [], "Voltage": amplitude})
for element in assignment:
if isinstance(element, str) and element in object_names_set:
props["Objects"].append(element)

Check warning on line 1014 in pyaedt/maxwell.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/maxwell.py#L1014

Added line #L1014 was not covered by tests
else:
props["Faces"].append(element)
bound = BoundaryObject(self, name, props, "Voltage")
if bound.create():
self._boundaries[bound.name] = bound
Expand Down
Loading