forked from mumax/3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemag2Dpbc2.mx3
55 lines (40 loc) · 1.53 KB
/
demag2Dpbc2.mx3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Test demag field for thin film.
Kernel should be approximately 0, 0, -1
*/
SetPBC(32, 0, 0)
SetGridSize(2, 128, 1)
SetCellSize(1e-9, 1e-9, 0.5e-9)
Msat = 1 / mu0
m = uniform(1, 0, 0)
expect("kxx", B_demag.Average()[0], 0, 1e-2) // not perfectly 0, finite film
expect("kxy", B_demag.Average()[1], 0, 1e-9)
expect("kxz", B_demag.Average()[2], 0, 1e-9)
m = uniform(0, 1, 0)
expect("kyx", B_demag.Average()[0], 0, 1e-9)
expect("kyy", B_demag.Average()[1], 0, 1e-2) // not perfectly 0, finite film
expect("kyz", B_demag.Average()[2], 0, 1e-9)
m = uniform(0, 0, 1)
expect("kzx", B_demag.Average()[0], 0, 1e-9)
expect("kzy", B_demag.Average()[1], 0, 1e-9)
expect("kzz", B_demag.Average()[2], -1, 2e-2) // not perfectly -1, finite film
/*
Repeat the above with an odd number of cells along x.
This led to a fft size mismatch panic in mumax3.10 and before.
*/
SetPBC(32, 0, 0)
SetGridSize(3, 128, 1)
SetCellSize(1e-9, 1e-9, 0.5e-9)
Msat = 1 / mu0
m = uniform(1, 0, 0)
expect("kxx", B_demag.Average()[0], 0, 1e-2) // not perfectly 0, finite film
expect("kxy", B_demag.Average()[1], 0, 1e-9)
expect("kxz", B_demag.Average()[2], 0, 1e-9)
m = uniform(0, 1, 0)
expect("kyx", B_demag.Average()[0], 0, 1e-9)
expect("kyy", B_demag.Average()[1], 0, 1e-2) // not perfectly 0, finite film
expect("kyz", B_demag.Average()[2], 0, 1e-9)
m = uniform(0, 0, 1)
expect("kzx", B_demag.Average()[0], 0, 1e-9)
expect("kzy", B_demag.Average()[1], 0, 1e-9)
expect("kzz", B_demag.Average()[2], -1, 2e-2) // not perfectly -1, finite film