assign_matrix#
- Maxwell3d.assign_matrix(args: MatrixElectric | MatrixACMagnetic | MatrixACMagneticAPhi | MatrixMagnetostatic) MaxwellParameters#
Assign sources to a matrix.
This is the unified method for matrix assignment in Maxwell 2D and 3D. The method automatically selects the correct internal assignment routine depending on the design’s
solution_type.Supported solution types:
ElectrostaticAC ConductionDC ConductionAC MagneticAC Magnetic A-PhiMagnetostatic
- Parameters:
- args:class:`ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix
- .MatrixElectric`, :class:`ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix.MatrixACMagnetic`,
- :class:`ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix.MatrixACMagneticAPhi` or
- :class:`ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix.MatrixMagnetostatic`
Structured argument container describing the sources to assign. The expected dataclass type depends on the active solver:
Electric solvers (Electrostatic, AC Conduction, DC Conduction):
:class:`ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix
- .MatrixElectric`
signal_sources: listground_sources: listmatrix_name: str (optional)
AC Magnetic solver:
ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix.MatrixACMagneticsources: list or dictmatrix_name: str (optional)
AC Magnetic A-Phi:
ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix.MatrixACMagneticAPhirl_sources: dictgc_sources: dictmatrix_name: str (optional)
Magnetostatic:
ansys.aedt.core.modules.boundary.maxwell_boundary.MaxwellMatrix.MatrixMagnetostaticsources: dictgroup_sources: dictbranches_number: intmatrix_name: str (optional)
- Returns:
ansys.aedt.core.modules.boundary.MaxwellParametersMaxwellParameters object.
References
>>> oModule.AssignMatrix
Examples
Setup a Maxwell 2D model in Electrostatic (valid for all electric solvers).
>>> from ansys.aedt.core import Maxwell2d >>> m2d = Maxwell2d(version="2025.2", solution_type=SolutionsMaxwell2D.ElectroStaticXY) >>> rectangle1 = m2d.modeler.create_rectangle([0.5, 1.5, 0], [2.5, 5], name="Sheet1") >>> rectangle2 = m2d.modeler.create_rectangle([9, 1.5, 0], [2.5, 5], name="Sheet2") >>> rectangle3 = m2d.modeler.create_rectangle([16.5, 1.5, 0], [2.5, 5], name="Sheet3") >>> voltage1 = m2d.assign_voltage([rectangle1], amplitude=1, name="Voltage1") >>> voltage2 = m2d.assign_voltage([rectangle2], amplitude=1, name="Voltage2") >>> voltage3 = m2d.assign_voltage([rectangle3], amplitude=1, name="Voltage3")
Define matrix assignments by instantiating the MaxwellElectric class.
>>> matrix_args = MaxwellMatrix.MatrixElectric( >>> signal_sources=[voltage1.name, voltage2.name], >>> ground_sources=[voltage3.name], >>> matrix_name="test_matrix", >>> )
Assign matrix. The method returns a MaxwellParameters object.
>>> matrix = m2d.assign_matrix(matrix_args) >>> m2d.release_desktop(True, True)
Setup a Maxwell 3D model in AC Magnetic A-Phi.
>>> from ansys.aedt.core import Maxwell3d >>> m3d = Maxwell3d(version="2025.2", solution_type=SolutionsMaxwell3D.ACMagneticAPhi) >>> box1 = m3d.modeler.create_box([0.5, 1.5, 0.5], [2.5, 5, 5], name="Sheet1", material="copper") >>> box2 = m3d.modeler.create_box([9, 1.5, 0.5], [2.5, 5, 5], name="Sheet2", material="copper") >>> box3 = m3d.modeler.create_box([16.5, 1.5, 0.5], [2.5, 5, 5], name="Sheet3", material="copper") >>> current1 = m3d.assign_current([box1.top_face_z], amplitude=1, name="Current1") >>> current2 = m3d.assign_current([box2.top_face_z], amplitude=1, name="Current2") >>> current3 = m3d.assign_current([box1.bottom_face_z], amplitude=1, name="Current3", swap_direction=True) >>> current4 = m3d.assign_current([box2.bottom_face_z], amplitude=1, name="Current4", swap_direction=True)
Define matrix assignments by instantiating the MatrixACMagneticAPhi class.
>>> rl_source = MaxwellMatrix.RLSourceACMagneticAPhi( >>> signal_sources=[current1.name], >>> ground_sources=[current3.name], >>> ) >>> gc_source = MaxwellMatrix.GCSourceACMagneticAPhi( >>> signal_sources=[current2.name], >>> ground_sources=[current4.name], >>> )
>>> matrix_args = MaxwellMatrix.MatrixACMagneticAPhi( >>> rl_sources=[rl_source], >>> gc_sources=[gc_source], >>> matrix_name="test_matrix", >>> )
Assign matrix. The method returns a MaxwellParameters object.
>>> matrix = m3d.assign_matrix(matrix_args) >>> m3d.release_desktop(True, True)