-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulation_6.mx3
executable file
·163 lines (143 loc) · 3.67 KB
/
simulation_6.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//output directory: smallv5_2.out/
Nx := 410
Ny := 110
Nz := 25
setGridSize(Nx, Ny, Nz)
setCellSize(5e-9, 4e-9, 4e-9)
Aex = 13e-12
Xi = 0.1
alpha = 0.02
angle := 360
ydim := 40e-9
zdim := 40e-9
translation := -27.5e-9
bigR := 20e-9
currentdensity := 3e12
timestep := 20e-12
totaltime := 5000e-12
wireDW := cuboid(2000e-9, ydim, zdim).transl(0, 0, 0)
wireSwitch := cuboid(75e-9, 380e-9, 5e-9).RotZ((360-angle)*pi/180).transl(410e-9, 0, translation)
wireSwitch_left := cuboid(75e-9, 380e-9, 5e-9).RotZ((360-angle)*pi/180).transl(-410e-9, 0, translation)
bottom := wireSwitch.add(wireSwitch_left)
setGeom(wireDW.add(bottom))
saveas(geom, "WireCross")
defRegion(1, wireDW)
defRegion(2, wireSwitch)
defRegion(3, cuboid(40e-9, ydim, zdim).transl(-980e-9, 0, 0))
defRegion(4, cuboid(40e-9, ydim, zdim).transl(980e-9, 0, 0))
defRegion(5, wireSwitch_left)
m.setRegion(1, twodomain(1, 0, 0, 0, 0, -1, -1, 0, 0))
m.setRegion(2, uniform(sin(-angle*pi/180), -cos(angle*pi/180), 0))
m.setRegion(3, uniform(1, 0, 0))
m.setRegion(4, uniform(-1, 0, 0))
m.setRegion(5, uniform(sin(-angle*pi/180), -cos(angle*pi/180), 0))
Msat.setRegion(1, 800e3)
Msat.setRegion(2, 800e3)
Msat.setRegion(3, 800e3)
Msat.setRegion(4, 800e3)
Msat.setRegion(5, 800e3)
frozenspins.setRegion(3, 1)
frozenspins.setRegion(4, 1)
BoundaryRegion := 1
MagLeft := 1
MagRight := -1
ext_rmSurfaceCharge(BoundaryRegion, MagLeft, MagRight)
saveas(m, "Init")
Minimize()
autosave(m, timestep)
tableadd(m.Region(2))
tableadd(E_anis)
tableadd(E_demag)
tableadd(E_exch)
tableadd(E_therm)
tableadd(E_total)
tableadd(E_Zeeman)
tableautosave(timestep)
pol.setRegion(1, 0.56)
J.setRegion(1, vector(-1*currentdensity, 0, 0))
maskout_1 := newVectorMask(Nx, Ny, Nz)
for i := 0; i < Nx; i++ {
for j := 0; j < 50; j++ {
for k := 0; k < Nz; k++ {
r := index2coord(i, j, k)
x := r.X()
y := r.Y()
z := r.Z()
d := sqrt(z*z + y*y)
B := (mu0 * 1 * currentdensity * ydim * zdim) / (2 * pi * d)
By := (-1 * B * z) / d
Bz := (B * y) / d
maskout_1.setVector(i, j, k, vector(0, By, Bz))
}
}
}
maskout_2 := newVectorMask(Nx, Ny, Nz)
for i := 0; i < Nx; i++ {
for j := 59; j < Ny; j++ {
for k := 0; k < Nz; k++ {
r := index2coord(i, j, k)
x := r.X()
y := r.Y()
z := r.Z()
d := sqrt(z*z + y*y)
B := (mu0 * 1 * currentdensity * ydim * zdim) / (2 * pi * d)
By := (-1 * B * z) / d
Bz := (B * y) / d
maskout_2.setVector(i, j, k, vector(0, By, Bz))
}
}
}
maskout_3 := newVectorMask(Nx, Ny, Nz)
for i := 0; i < Nx; i++ {
for j := 50; j < 59; j++ {
for k := 17; k < Nz; k++ {
r := index2coord(i, j, k)
x := r.X()
y := r.Y()
z := r.Z()
d := sqrt(z*z + y*y)
B := (mu0 * 1 * currentdensity * ydim * zdim) / (2 * pi * d)
By := (-1 * B * z) / d
Bz := (B * y) / d
maskout_3.setVector(i, j, k, vector(0, By, Bz))
}
}
}
maskout_4 := newVectorMask(Nx, Ny, Nz)
for i := 0; i < Nx; i++ {
for j := 50; j < 59; j++ {
for k := 0; k < 8; k++ {
r := index2coord(i, j, k)
x := r.X()
y := r.Y()
z := r.Z()
d := sqrt(z*z + y*y)
B := (mu0 * 1 * currentdensity * ydim * zdim) / (2 * pi * d)
By := (-1 * B * z) / d
Bz := (B * y) / d
maskout_4.setVector(i, j, k, vector(0, By, Bz))
}
}
}
maskin := newVectorMask(Nx, Ny, Nz)
for i := 0; i < Nx; i++ {
for j := 49; j < 60; j++ {
for k := 7; k < 18; k++ {
r := index2coord(i, j, k)
x := r.X()
y := r.Y()
z := r.Z()
d := sqrt(z*z + y*y)
B := (mu0 * 1 * currentdensity * ydim * zdim * d) / (2 * pi * bigR * bigR)
By := (-1 * B * z) / d
Bz := (B * y) / d
maskin.setVector(i, j, k, vector(0, By, Bz))
}
}
}
B_ext.add(maskout_1, 1)
B_ext.add(maskout_2, 1)
B_ext.add(maskout_3, 1)
B_ext.add(maskout_4, 1)
B_ext.add(maskin, 1)
Run(totaltime)