|
1 | 1 | # # Maxwell 3D: fields export in transient
|
2 |
| -# This example uses PyAEDT to setup transient analysis |
3 |
| -# of an imported Maxwell 3D model and aim to plot |
4 |
| -# the current density field over a coil surface and export the fields data. |
5 |
| -# Keywords: time steps, fields calculator, field export |
| 2 | +# |
| 3 | +# This example shows how to leverage PyAEDT to set up a Maxwell 3D transient analysis, |
| 4 | +# compute the average value of the current density field over a specific coil surface |
| 5 | +# and the magnitude of the current density field over all coil surfaces at each time step |
| 6 | +# of the transient analysis. |
| 7 | +# Keywords: transient, fields calculator, field export |
6 | 8 |
|
7 | 9 | # ## Perform required imports
|
8 | 10 | #
|
9 | 11 | # Perform required imports.
|
10 | 12 |
|
11 | 13 | import tempfile
|
| 14 | +import time |
12 | 15 |
|
13 | 16 | import pyaedt
|
14 | 17 |
|
|
28 | 31 |
|
29 | 32 | # ## Import project
|
30 | 33 | #
|
31 |
| -# The files required to run this example will be downloaded to the temporary working folder. |
| 34 | +# The files required to run this example will be downloaded into the temporary working folder. |
32 | 35 |
|
33 | 36 | project_path = pyaedt.downloads.download_file(
|
34 | 37 | source="maxwell_transient_fields",
|
35 | 38 | name="M3D_Transient_StrandedWindings.aedt",
|
36 |
| - destination=temp_folder.name |
| 39 | + destination=temp_folder.name, |
37 | 40 | )
|
38 | 41 |
|
39 | 42 | # ## Initialize and launch Maxwell 3D
|
40 | 43 | #
|
41 |
| -# Initialize and launch Maxwell 3D, providing the version, and the path of the imported project. |
| 44 | +# Initialize and launch Maxwell 3D, providing the version and the path of the project. |
42 | 45 |
|
43 | 46 | m3d = pyaedt.Maxwell3d(
|
44 | 47 | project=project_path, version=AEDT_VERSION, non_graphical=NG_MODE
|
|
61 | 64 | # ## Create field expressions
|
62 | 65 | #
|
63 | 66 | # Create a field expression to evaluate J normal to a surface using the advanced fields calculator.
|
| 67 | +# The expression is created as a dictionary and then provided as an argument to ``add_expression``. |
64 | 68 |
|
65 | 69 | my_expression = {
|
66 | 70 | "name": "Jn",
|
|
122 | 126 | data = sol.get_solution_data()
|
123 | 127 | time_steps = data.intrinsics["Time"]
|
124 | 128 |
|
125 |
| -# ## Create a field plot over the coil surface and export field data |
| 129 | +# ## Create field plots over the coil surfaces and export field data |
126 | 130 | #
|
127 | 131 | # Convert each time step into ``ms``.
|
128 |
| -# Create fields plot on the surface of each coil by specifying the coil object, |
| 132 | +# Create field plots over the surface of each coil by specifying the coil object, |
129 | 133 | # the quantity to plot and the time step.
|
130 | 134 | # The average value of J normal is plotted on Coil_A2 surface for every time-step.
|
131 | 135 | # The J field is plotted on the surface of each coil for every time-step.
|
|
169 | 173 | # Release AEDT and remove both the project and temporary directory.
|
170 | 174 |
|
171 | 175 | m3d.release_desktop()
|
| 176 | + |
| 177 | +time.sleep(3) |
172 | 178 | temp_folder.cleanup()
|
0 commit comments