assign_force#
- Maxwell2d.assign_force(assignment, coordinate_system='Global', is_virtual=True, force_name=None)#
Assign a force to one or more objects.
Force assignment can be calculated based upon the solver type. For 3D solvers the available solution types are:
Magnetostatic
,Electrostatic
,Eddy Current
,Transient
andElectric Transient
. For 2D solvers the available solution types are:Magnetostatic
,Electrostatic
,Eddy Current
andTransient
.- Parameters:
- assignment
str
,list
One or more objects to assign the force to.
- coordinate_system
str
,optional
Name of the reference coordinate system. The default is
"Global"
.- is_virtualbool,
optional
Whether the force is virtual. The default is
True.
- force_name
str
,optional
Name of the force. The default is
None
, in which case the default name is used.
- assignment
- Returns:
- bool
True
when successful,False
when failed.
References
>>> oModule.AssignForce
Examples
Assign virtual force to a magnetic object:
>>> from ansys.aedt.core import Maxwell3d >>> m3d = Maxwell3d() >>> iron_object = m3d.modeler.create_box([0, 0, 0],[2, 10, 10],name="iron") >>> magnet_object = m3d.modeler.create_box([10, 0, 0],[2, 10, 10],name="magnet") >>> m3d.assign_material(iron_object,"iron") >>> m3d.assign_material(magnet_object,"NdFe30") >>> m3d.assign_force("iron",is_virtual=True,force_name="force_iron")
Assign Lorentz force to a conductor:
>>> conductor1 = m3d.modeler.create_box([0, 0, 0],[1, 1, 10],name="conductor1") >>> conductor2 = m3d.modeler.create_box([10, 0, 0],[1, 1, 10],name="conductor2") >>> m3d.assign_material(conductor1,"copper") >>> m3d.assign_material(conductor2,"copper") >>> m3d.assign_force("conductor1",is_virtual=False,force_name="force_copper") # conductor, use Lorentz force >>> m3d.release_desktop(True, True)