|
1 | | -import magpylib as magpy |
| 1 | +# import magpylib as magpy |
2 | 2 |
|
3 | | -import magpylib_material_response |
| 3 | +# import magpylib_material_response |
4 | 4 |
|
5 | | -print(magpylib_material_response.__version__) |
6 | | -import matplotlib.pyplot as plt |
7 | | -import numpy as np |
| 5 | +# print(magpylib_material_response.__version__) |
| 6 | +# import matplotlib.pyplot as plt |
| 7 | +# import numpy as np |
8 | 8 |
|
9 | | -from magpylib_material_response.demag import apply_demag |
10 | | -from magpylib_material_response.meshing import mesh_Cuboid |
| 9 | +# from magpylib_material_response.demag import apply_demag |
| 10 | +# from magpylib_material_response.meshing import mesh_Cuboid |
11 | 11 |
|
12 | | -elements = 4 |
| 12 | +# elements = 4 |
13 | 13 |
|
14 | | -# hollow cylinder magnet |
15 | | -cuboid = magpy.magnet.Cuboid(polarization=(1, 2, 3), dimension=(2, 2, 2)) |
16 | | -coll = mesh_Cuboid(cuboid, elements) |
17 | | -# coll.susceptibility = (1,2,3,4) |
18 | | -for i in range(len(coll)): |
19 | | - coll[i].susceptibility = (i, i, i * 10) |
20 | | - # coll[i].susceptibility = i |
21 | | -# coll.H_ext = (-10,-10,-10) |
22 | | -coll = apply_demag(coll) |
| 14 | +# # hollow cylinder magnet |
| 15 | +# cuboid = magpy.magnet.Cuboid(polarization=(1, 2, 3), dimension=(2, 2, 2)) |
| 16 | +# coll = mesh_Cuboid(cuboid, elements) |
| 17 | +# # coll.susceptibility = (1,2,3,4) |
| 18 | +# for i in range(len(coll)): |
| 19 | +# coll[i].susceptibility = (i, i, i * 10) |
| 20 | +# # coll[i].susceptibility = i |
| 21 | +# # coll.H_ext = (-10,-10,-10) |
| 22 | +# coll = apply_demag(coll) |
23 | 23 |
|
24 | | -fig, ax = plt.subplots() |
| 24 | +# fig, ax = plt.subplots() |
25 | 25 |
|
26 | | -ts = np.linspace(0, 1, 9) |
27 | | -grid = np.array([[(x, 0.1, z) for x in ts] for z in ts]) |
| 26 | +# ts = np.linspace(0, 1, 9) |
| 27 | +# grid = np.array([[(x, 0.1, z) for x in ts] for z in ts]) |
28 | 28 |
|
29 | | -B = coll.getM(grid) |
| 29 | +# B = coll.getM(grid) |
30 | 30 |
|
31 | | -# Display the B-field with streamplot using log10-scaled |
32 | | -# color function and linewidth |
33 | | -splt = ax.quiver(grid[:, :, 0], grid[:, :, 2], B[:, :, 0], B[:, :, 2]) |
| 31 | +# # Display the B-field with streamplot using log10-scaled |
| 32 | +# # color function and linewidth |
| 33 | +# splt = ax.quiver(grid[:, :, 0], grid[:, :, 2], B[:, :, 0], B[:, :, 2]) |
34 | 34 |
|
35 | | -print(B) |
| 35 | +# print(B) |
36 | 36 |
|
37 | 37 |
|
38 | | -# Figure styling |
39 | | -ax.set( |
40 | | - xlabel="x-position (mm)", |
41 | | - ylabel="z-position (mm)", |
42 | | -) |
| 38 | +# # Figure styling |
| 39 | +# ax.set( |
| 40 | +# xlabel="x-position (mm)", |
| 41 | +# ylabel="z-position (mm)", |
| 42 | +# ) |
43 | 43 |
|
44 | | -plt.tight_layout() |
45 | | -plt.show() |
| 44 | +# plt.tight_layout() |
| 45 | +# plt.show() |
0 commit comments