assign_matrix#
- Maxwell2d.assign_matrix(assignment, matrix_name=None, turns=None, return_path=None, group_sources=None, branches=None)#
Assign a matrix to the selection.
Matrix assignment can be calculated based upon the solver type. For 2D/3D solvers the available solution types are:
Magnetostatic
,Electrostatic
,Eddy Current
,DC Conduction
andAC Conduction
.- Parameters:
- assignment
list
,str
List of sources to assign a matrix to.
- matrix_name
str
,optional
Name of the matrix. The default is
None
.- turns
list
,int
,optional
Number of turns. The default is 1.
- return_path
list
,str
,optional
Return path. The default is
infinite
- group_sources
dict
,list
optional
Dictionary consisting of
{Group Name: list of source names}
to add multiple groups. You can also define a list of strings. The default isNone
.- branches:
list
,int
,optional
Number of branches. The default is
None
, which indicates that only one branch exists.
- assignment
- Returns:
ansys.aedt.core.modules.boundary.BoundaryObject
Boundary object.
References
>>> oModule.AssignMatrix
Examples
Set matrix in a Maxwell magnetostatic analysis.
>>> from ansys.aedt.core import Maxwell2d >>> m2d = Maxwell2d(solution_type="MagnetostaticXY",version="2022.1",close_on_exit=True) >>> coil1 = m2d.modeler.create_rectangle([0, 1.5, 0], [8, 3], is_covered=True, name="Coil_1") >>> coil2 = m2d.modeler.create_rectangle([8.5, 1.5, 0], [8, 3], is_covered=True, name="Coil_2") >>> coil3 = m2d.modeler.create_rectangle([16, 1.5, 0], [8, 3], is_covered=True, name="Coil_3") >>> coil4 = m2d.modeler.create_rectangle([32, 1.5, 0], [8, 3], is_covered=True, name="Coil_4") >>> current1 = m2d.assign_current(assignment="Coil_1",amplitude=1,swap_direction=False,name="Current1") >>> current2 = m2d.assign_current(assignment="Coil_2",amplitude=1,swap_direction=True,name="Current2") >>> current3 = m2d.assign_current(assignment="Coil_3",amplitude=1,swap_direction=True,name="Current3") >>> current4 = m2d.assign_current(assignment="Coil_4",amplitude=1,swap_direction=True,name="Current4") >>> group_sources = {"Group1_Test": ["Current1", "Current3"], "Group2_Test": ["Current2", "Current4"]} >>> selection = ['Current1', 'Current2', 'Current3', 'Current4'] >>> turns = [5, 1, 2, 3] >>> L = m2d.assign_matrix(assignment=selection,matrix_name="Test2",turns=turns,group_sources=group_sources)
Set matrix in a Maxwell DC Conduction analysis. >>> m2d.assign_voltage([“Port1”],amplitude=1,name=”1V”) >>> m2d.assign_voltage([“Port2”],amplitude=0,name=”0V”) >>> m2d.assign_matrix(assignment=[‘1V’],matrix_name=”Matrix1”,group_sources=[‘0V’]) >>> m2d.release_desktop(True, True)