@@ -186,8 +186,8 @@ def apply_skew(
186
186
props .update (arg_slice_table )
187
187
return self .change_design_settings (props )
188
188
189
- @pyaedt_function_handler ()
190
- def set_core_losses (self , objects , value = False ):
189
+ @pyaedt_function_handler (value = "core_loss_on_field" )
190
+ def set_core_losses (self , objects , core_loss_on_field = False ):
191
191
"""Whether to enable core losses for a set of objects.
192
192
193
193
For ``EddyCurrent`` and ``Transient`` solver designs, core losses calulcations
@@ -198,7 +198,7 @@ def set_core_losses(self, objects, value=False):
198
198
----------
199
199
objects : list, str
200
200
List of object to apply core losses to.
201
- value : bool, optional
201
+ core_loss_on_field : bool, optional
202
202
Whether to enable ``Consider core loss effect on field`` for the given list. The default is
203
203
``False``.
204
204
@@ -217,13 +217,13 @@ def set_core_losses(self, objects, value=False):
217
217
Set core losses in Maxwell 3D.
218
218
219
219
>>> from pyaedt import Maxwell3d
220
- >>> maxwell_3d = Maxwell3d()
221
- >>> maxwell_3d .set_core_losses(["PQ_Core_Bottom", "PQ_Core_Top"], True)
222
-
220
+ >>> m3d = Maxwell3d()
221
+ >>> m3d .set_core_losses(objects= ["PQ_Core_Bottom", "PQ_Core_Top"],core_loss_on_field= True)
222
+ >>> m3d.release_desktop(True, True)
223
223
"""
224
224
if self .solution_type in ["EddyCurrent" , "Transient" ]:
225
225
objects = self .modeler .convert_to_selections (objects , True )
226
- self .oboundary .SetCoreLoss (objects , value )
226
+ self .oboundary .SetCoreLoss (objects , core_loss_on_field )
227
227
return True
228
228
else :
229
229
raise Exception ("Core losses is only available with `EddyCurrent` and `Transient` solutions." )
@@ -277,15 +277,16 @@ def assign_matrix(
277
277
--------
278
278
Set matrix in a Maxwell magnetostatic analysis.
279
279
280
+ >>> from pyaedt import Maxwell2d
280
281
>>> m2d = Maxwell2d(solution_type="MagnetostaticXY",specified_version="2022.1",close_on_exit=True)
281
282
>>> coil1 = m2d.modeler.create_rectangle([0, 1.5, 0], [8, 3], is_covered=True, name="Coil_1")
282
283
>>> coil2 = m2d.modeler.create_rectangle([8.5, 1.5, 0], [8, 3], is_covered=True, name="Coil_2")
283
284
>>> coil3 = m2d.modeler.create_rectangle([16, 1.5, 0], [8, 3], is_covered=True, name="Coil_3")
284
285
>>> coil4 = m2d.modeler.create_rectangle([32, 1.5, 0], [8, 3], is_covered=True, name="Coil_4")
285
- >>> current1 = m2d.assign_current("Coil_1",amplitude=1,swap_direction=False,name="Current1")
286
- >>> current2 = m2d.assign_current("Coil_2",amplitude=1,swap_direction=True,name="Current2")
287
- >>> current3 = m2d.assign_current("Coil_3",amplitude=1,swap_direction=True,name="Current3")
288
- >>> current4 = m2d.assign_current("Coil_4",amplitude=1,swap_direction=True,name="Current4")
286
+ >>> current1 = m2d.assign_current(objects= "Coil_1",amplitude=1,swap_direction=False,name="Current1")
287
+ >>> current2 = m2d.assign_current(objects= "Coil_2",amplitude=1,swap_direction=True,name="Current2")
288
+ >>> current3 = m2d.assign_current(objects= "Coil_3",amplitude=1,swap_direction=True,name="Current3")
289
+ >>> current4 = m2d.assign_current(objects= "Coil_4",amplitude=1,swap_direction=True,name="Current4")
289
290
>>> group_sources = {"Group1_Test": ["Current1", "Current3"], "Group2_Test": ["Current2", "Current4"]}
290
291
>>> selection = ['Current1', 'Current2', 'Current3', 'Current4']
291
292
>>> turns = [5, 1, 2, 3]
@@ -295,7 +296,7 @@ def assign_matrix(
295
296
>>> m2d.assign_voltage(["Port1"],amplitude=1,name="1V")
296
297
>>> m2d.assign_voltage(["Port2"],amplitude=0,name="0V")
297
298
>>> m2d.assign_matrix(sources=['1V'], group_sources=['0V'], matrix_name="Matrix1")
298
-
299
+ >>> m2d.release_desktop(True, True)
299
300
"""
300
301
301
302
sources = self .modeler .convert_to_selections (sources , True )
@@ -634,9 +635,10 @@ def setup_y_connection(self, windings=None):
634
635
This creates one ``YConnection`` group containing these three phases.
635
636
636
637
>>> from pyaedt import Maxwell2d
637
- >>> aedtapp = Maxwell2d("Motor_EM_R2019R3.aedt")
638
- >>> aedtapp.set_active_design("Basis_Model_For_Test")
639
- >>> aedtapp.setup_y_connection(["PhaseA", "PhaseB", "PhaseC"])
638
+ >>> m2d = Maxwell2d("Motor_EM_R2019R3.aedt")
639
+ >>> m2d.set_active_design("Basis_Model_For_Test")
640
+ >>> m2d.setup_y_connection(["PhaseA", "PhaseB", "PhaseC"])
641
+ >>> m2d.release_desktop(True, True)
640
642
"""
641
643
642
644
if self .solution_type not in ["Transient" ]:
@@ -689,9 +691,10 @@ def assign_current(self, objects, amplitude=1, phase="0deg", solid=True, swap_di
689
691
--------
690
692
691
693
>>> from pyaedt import Maxwell3d
692
- >>> app = pyaedt.Maxwell3d(solution_type="ElectroDCConduction")
693
- >>> cylinder= app.modeler.create_cylinder("X", [0,0,0],10, 100, 250)
694
- >>> current = app.assign_current(cylinder.top_face_x.id,amplitude="2mA")
694
+ >>> m3d = Maxwell3d(solution_type="ElectroDCConduction")
695
+ >>> cylinder= m3d.modeler.create_cylinder("X", [0,0,0],10, 100, 250)
696
+ >>> current = m3d.assign_current(cylinder.top_face_x.id,amplitude="2mA")
697
+ >>> m3d.release_desktop(True, True)
695
698
"""
696
699
697
700
if isinstance (amplitude , (int , float )):
@@ -1244,6 +1247,8 @@ def assign_force(self, objects, coordinate_system="Global", is_virtual=True, for
1244
1247
1245
1248
Assign virtual force to a magnetic object:
1246
1249
1250
+ >>> from pyaedt import Maxwell3d
1251
+ >>> m3d = Maxwell3d()
1247
1252
>>> iron_object = m3d.modeler.create_box([0, 0, 0], [2, 10, 10], name="iron")
1248
1253
>>> magnet_object = m3d.modeler.create_box([10, 0, 0], [2, 10, 10], name="magnet")
1249
1254
>>> m3d.assign_material(iron_object, "iron")
@@ -1257,6 +1262,7 @@ def assign_force(self, objects, coordinate_system="Global", is_virtual=True, for
1257
1262
>>> m3d.assign_material(conductor1, "copper")
1258
1263
>>> m3d.assign_material(conductor2, "copper")
1259
1264
>>> m3d.assign_force("conductor1",is_virtual=False,force_name="force_copper") # conductor, use Lorentz force
1265
+ >>> m3d.release_desktop(True, True)
1260
1266
"""
1261
1267
if self .solution_type not in ["ACConduction" , "DCConduction" ]:
1262
1268
objects = self .modeler .convert_to_selections (objects , True )
@@ -1989,9 +1995,9 @@ def create_setup(self, setup_name="MySetupAuto", setup_type=None, **kwargs):
1989
1995
Examples
1990
1996
--------
1991
1997
>>> from pyaedt import Maxwell3d
1992
- >>> app = Maxwell3d()
1998
+ >>> m3d = Maxwell3d()
1993
1999
>>> app.create_setup(setup_name="My_Setup",setup_type="EddyCurrent",MaximumPasses=10,PercentError=2)
1994
-
2000
+ >>> m3d.release_desktop(True, True)
1995
2001
"""
1996
2002
if setup_type is None :
1997
2003
setup_type = self .design_solutions .default_setup
@@ -2074,13 +2080,13 @@ class Maxwell3d(Maxwell, FieldAnalysis3D, object):
2074
2080
project, which is named ``mymaxwell.aedt``.
2075
2081
2076
2082
>>> from pyaedt import Maxwell3d
2077
- >>> aedtapp = Maxwell3d("mymaxwell.aedt")
2083
+ >>> m3d = Maxwell3d("mymaxwell.aedt")
2078
2084
PyAEDT INFO: Added design ...
2079
2085
2080
- Create an instance of Maxwell 3D using the 2023 R2 release and open
2086
+ Create an instance of Maxwell 3D using the 2024 R1 release and open
2081
2087
the specified project, which is named ``mymaxwell2.aedt``.
2082
2088
2083
- >>> aedtapp = Maxwell3d(specified_version="2023.2 ", projectname ="mymaxwell2.aedt")
2089
+ >>> m3d = Maxwell3d(specified_version="2024.1 ", project_name ="mymaxwell2.aedt")
2084
2090
PyAEDT INFO: Added design ...
2085
2091
2086
2092
"""
@@ -2832,18 +2838,18 @@ class Maxwell2d(Maxwell, FieldAnalysis3D, object):
2832
2838
not exist.
2833
2839
2834
2840
>>> from pyaedt import Maxwell2d
2835
- >>> aedtapp = Maxwell2d()
2841
+ >>> m2d = Maxwell2d()
2836
2842
2837
2843
Create an instance of Maxwell 2D and link to a project named
2838
- ``projectname ``. If this project does not exist, create one with
2844
+ ``project_name ``. If this project does not exist, create one with
2839
2845
this name.
2840
2846
2841
- >>> aedtapp = Maxwell2d(projectname )
2847
+ >>> m2d = Maxwell2d(project_name )
2842
2848
2843
2849
Create an instance of Maxwell 2D and link to a design named
2844
- ``designname `` in a project named ``projectname ``.
2850
+ ``design_name `` in a project named ``project_name ``.
2845
2851
2846
- >>> aedtapp = Maxwell2d(projectname,designame )
2852
+ >>> m2d = Maxwell2d(project_name,design_name )
2847
2853
2848
2854
"""
2849
2855
0 commit comments