Skip to content

Commit

Permalink
FEAT: maxwell electrostatic matrix (#5465)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalinve authored Nov 22, 2024
1 parent 3cccdeb commit f3d9bbe
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
14 changes: 10 additions & 4 deletions src/ansys/aedt/core/visualization/post/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ def available_quantities_categories(
"SimValueContext:=",
[37010, 0, 2, 0, False, False, -1, 1, 0, 1, 1, "", 0, 0, "DCIRID", False, id_, "IDIID", False, "1"],
]
elif self._app.design_type in ["Maxwell 2D", "Maxwell 3D"] and self._app.solution_type == "EddyCurrent":
elif self._app.design_type in ["Maxwell 2D", "Maxwell 3D"] and self._app.solution_type in [
"EddyCurrent",
"Electrostatic",
]:
if isinstance(context, dict):
for k, v in context.items():
context = ["Context:=", k, "Matrix:=", v]
Expand Down Expand Up @@ -400,7 +403,10 @@ def available_report_quantities(
]
else:
context = ["Diff:=", "differential_pairs", "Domain:=", "Sweep"]
elif self._app.design_type in ["Maxwell 2D", "Maxwell 3D"] and self._app.solution_type == "EddyCurrent":
elif self._app.design_type in ["Maxwell 2D", "Maxwell 3D"] and self._app.solution_type in [
"EddyCurrent",
"Electrostatic",
]:
if isinstance(context, dict):
for k, v in context.items():
context = ["Context:=", k, "Matrix:=", v]
Expand Down Expand Up @@ -1289,8 +1295,8 @@ def create_report(
report.matrix = context
elif (
self._app.design_type in ["Maxwell 2D", "Maxwell 3D"]
and self._app.solution_type == "EddyCurrent"
and context
and self._app.solution_type in ["EddyCurrent", "Electrostatic"]
):
if isinstance(context, dict):
for k, v in context.items():
Expand Down Expand Up @@ -1514,8 +1520,8 @@ def get_solution_data(
report.matrix = context
elif (
self._app.design_type in ["Maxwell 2D", "Maxwell 3D"]
and self._app.solution_type == "EddyCurrent"
and context
and self._app.solution_type in ["EddyCurrent", "Electrostatic"]
):
if isinstance(context, dict):
for k, v in context.items():
Expand Down
10 changes: 5 additions & 5 deletions src/ansys/aedt/core/visualization/report/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ def _context(self):
ctxt = ["Context:=", "Original"]
else:
ctxt = ["Context:=", self.matrix]
elif (
self._post._app.design_type in ["Maxwell 2D", "Maxwell 3D"]
and self._post._app.solution_type == "EddyCurrent"
):
elif self._post._app.design_type in ["Maxwell 2D", "Maxwell 3D"] and self._post._app.solution_type in [
"EddyCurrent",
"Electrostatic",
]:
if not self.matrix:
ctxt = ["Context:=", "Original"]
elif not self.reduced_matrix:
elif self.matrix and not self.reduced_matrix:
ctxt = ["Context:=", self.matrix]
elif self.reduced_matrix:
ctxt = ["Context:=", self.matrix, "Matrix:=", self.reduced_matrix]
Expand Down
19 changes: 19 additions & 0 deletions tests/system/general/test_28_Maxwell3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,27 @@ def test_32_matrix(self, add_app):
m3d.assign_voltage(box1.faces, amplitude=1, name="Voltage6")
m3d.assign_voltage(box2, amplitude=1, name="Voltage7")

setup = m3d.create_setup(MaximumPasses=2)
m3d.analyze(setup=setup.name)

L = m3d.assign_matrix(assignment="Voltage1")
assert L.props["MatrixEntry"]["MatrixEntry"][0]["Source"] == "Voltage1"
cat = m3d.post.available_quantities_categories(context=L.name)
assert isinstance(cat, list)
assert "C" in cat
quantities = m3d.post.available_report_quantities(
display_type="Data Table", quantities_category="C", context=L.name
)
assert isinstance(quantities, list)
report = m3d.post.create_report(
expressions=quantities,
plot_type="Data Table",
context=L.name,
primary_sweep_variable="X",
variations={"X": "All"},
)
assert quantities == report.expressions
assert report.matrix == L.name
assert L.delete()
group_sources = "Voltage2"
L = m3d.assign_matrix(assignment=["Voltage1", "Voltage3"], matrix_name="Test1", group_sources=group_sources)
Expand Down

0 comments on commit f3d9bbe

Please sign in to comment.