-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6c7a20
commit 5374617
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
import numpy as np | ||
import magpylib as magpy | ||
import magpylib_material_response | ||
from magpylib_material_response.demag import apply_demag | ||
from magpylib_material_response.meshing import mesh_Cuboid | ||
|
||
|
||
def test_version(): | ||
assert isinstance(magpylib_material_response.__version__, str) | ||
|
||
|
||
def test_susceptibility_inputs(): | ||
""" | ||
test if different xi inputs give the same result | ||
""" | ||
|
||
zone = magpy.magnet.Cuboid( | ||
dimension=(1,1,1), | ||
polarization=(0,0,1), | ||
) | ||
mesh = mesh_Cuboid(zone, (2,2,2)) | ||
|
||
dm1 = apply_demag(mesh, susceptibility=4) | ||
dm2 = apply_demag(mesh, susceptibility=(4,4,4)) | ||
dm3 = apply_demag(mesh, susceptibility=[4]*8) | ||
dm4 = apply_demag(mesh, susceptibility=[(4,4,4)]*8) | ||
|
||
zone = magpy.magnet.Cuboid( | ||
dimension=(1,1,1), | ||
polarization=(0,0,1), | ||
) | ||
zone.susceptibility = 4 | ||
mesh = mesh_Cuboid(zone, (2,2,2)) | ||
dm5 = apply_demag(mesh) | ||
|
||
zone = magpy.magnet.Cuboid( | ||
dimension=(1,1,1), | ||
polarization=(0,0,1), | ||
) | ||
zone.susceptibility = (4,4,4) | ||
mesh = mesh_Cuboid(zone, (2,2,2)) | ||
dm6 = apply_demag(mesh) | ||
|
||
b1 = dm1.getB((1,2,3)) | ||
for dm in [dm2,dm3,dm4,dm5,dm6]: | ||
bb = dm.getB((1,2,3)) | ||
np.testing.assert_allclose(b1,bb) |