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

FEAT: MaxwellMatrix class #4855

Merged
merged 8 commits into from
Jul 3, 2024
Merged
Changes from 1 commit
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
40 changes: 40 additions & 0 deletions pyaedt/modules/Boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,16 @@
self.type = boundarytype
self._boundary_name = self.name
self.auto_update = True
self.reduced_matrices = []
self.assignment = None
for p in list(self._app.odesign.GetChildObject("Parameters").GetChildNames()):
if self._app.odesign.GetChildObject("Parameters").GetChildObject(p).GetPropValue("Type") == "Matrix":
self.assignment = (

Check warning on line 1421 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L1417-L1421

Added lines #L1417 - L1421 were not covered by tests
self._app.odesign.GetChildObject("Parameters")
.GetChildObject(name)
.GetPropValue("Selection")
.split(",")
)

@property
def object_properties(self):
Expand Down Expand Up @@ -1530,6 +1540,9 @@

@pyaedt_function_handler()
def _create_matrix_reduction(self, red_type, sources, matrix_name=None, join_name=None):
if not self._app.solution_type == "EddyCurrent":
self._app.logger.error("Matrix reduction is possible only in Eddy current solvers.")
return False, False

Check warning on line 1545 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L1543-L1545

Added lines #L1543 - L1545 were not covered by tests
if not matrix_name:
matrix_name = generate_unique_name("ReducedMatrix", n=3)
if not join_name:
Expand All @@ -1540,6 +1553,7 @@
matrix_name,
["NAME:" + join_name, "Type:=", "Join in " + red_type, "Sources:=", ",".join(sources)],
)
self.reduced_matrices = MaxwellMatrix(self._app, self.name)

Check warning on line 1556 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L1556

Added line #L1556 was not covered by tests
return matrix_name, join_name
except Exception:
self._app.logger.error("Failed to create Matrix Reduction")
Expand Down Expand Up @@ -1592,6 +1606,32 @@
)


class MaxwellMatrix(object):
def __init__(self, app, parent_name):
self._app = app
self._parent_matrix = parent_name
self.names = []
self.sources = []
if self._app.solution_type == "EddyCurrent":
self.names = self._app.odesign.GetChildObject("Parameters").GetChildObject(parent_name).GetChildNames()
for m in self.names:
sources = (

Check warning on line 1618 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L1611-L1618

Added lines #L1611 - L1618 were not covered by tests
self._app.odesign.GetChildObject("Parameters")
.GetChildObject(parent_name)
.GetChildObject(m)
.GetChildNames()
)
for s in sources:
excitations = (

Check warning on line 1625 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L1624-L1625

Added lines #L1624 - L1625 were not covered by tests
self._app.odesign.GetChildObject("Parameters")
.GetChildObject(parent_name)
.GetChildObject(m)
.GetChildObject(s)
.GetPropValue("Source")
)
self.sources.append({m: {s: excitations}})

Check warning on line 1632 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L1632

Added line #L1632 was not covered by tests


class FieldSetup(BoundaryCommon, object):
"""Manages Far Field and Near Field Component data and execution.

Expand Down
Loading