assign_force#
- Maxwell3d.assign_force(input_object, reference_cs='Global', is_virtual=True, force_name=None)[source]#
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:
- input_object
str
,list
One or more objects to assign the force to.
- reference_cs
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.
- input_object
- Returns:
- bool
True
when successful,False
when failed.
References
>>> oModule.AssignForce
Examples
Assign virtual force to a magnetic object:
>>> 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", force_name="force_iron", is_virtual=True)
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", force_name="force_copper", is_virtual=False) # conductor, use Lorentz force