Hi all,
Below is the code for setting up radial or azimuthal magnetization states in nanotubes. It allows for the configuration of complex magnetization states in Cartesian coordinates without requiring excessive region definitions.
If I want to excite a radial magnetic field of the form B0*cos(wt)cos(nφ), where n is an integer and φ is the azimuthal angle, or if I need to set up some complex anisu, can this also be achieved using a similar approach? On the API page, I only see commands like m.setarray, but not something like b_ext.setarray.
If this is not possible,when simulating double-layer or even multi-layer tubular antiferromagnetic or ferrimagnetic structures, 256 regions might be insufficient. Has anyone encountered this limitation and found a workaround?
Best regards,
Qwenthur
//
mask := newslice(3, od, od, tz)
angle := 0.0
for i := 0; i < tz; i++ {
for j := 0; j < od; j++ {
for k := 0; k < od; k++ {
r := index2coord(j, k, i)
x := r.x()
y := r.y()
z := r.z()
if x == 0 && y > 0 {
angle = pi / 2
} else if x == 0 && y <= 0 {
angle = -pi / 2
} else if x > 0 {
angle = atan(y / x)
} else {
angle = pi - atan(-y/x)
}
mx := cos(angle)
my := sin(angle)
mz := 0
mask.set(0, j, k, i, mx)
mask.set(1, j, k, i, my)
mask.set(2, j, k, i, mz)
}
}
}
m.setarray(mask)
//