mumax / 3

GPU-accelerated micromagnetic simulator
Other
450 stars 150 forks source link

Are randommag() and randommagseed() functions really random? #183

Closed pankajmandal4003 closed 6 years ago

pankajmandal4003 commented 6 years ago

I tried to run the same simulation for my magnetic geometry with initialisation of moments using randommag() or randommagseed(). However, at every run, I see the initial random configuration of moments are the same. This therefore gives me the same relaxed output. Which means I can not check whether my relaxed geometry is a computational artefact or real physical stuff.

Any help or suggestion is welcome. Below is the code!

Msat = 5.68e3
anisU = vector(0, 0, 1)
Ku1 = 2.84e3
Aex = 7.2e-13
alpha = 0.3

d := 1.0e-9 // 1 nm Sizex := 250d // magnet size x Sizey := 250d Sizez := 10*d

SetGridSize(256, 256, 4)
SetCellSize(Sizex/256, Sizey/256, Sizez/4)

EdgeSmooth = 8

a := cylinder(Sizex, Sizez) b := cylinder(Sizex/2, Sizez) setgeom( a.sub(b) ) saveas(geom, "Torus")

m = randommag() // initial mag along z (easy axis) saveas(m, "m_initial") tablesave()

relax()
save(m)

saveas(m, "m_final") // remanent magnetization saveas(B_demag, "Magnetostat-field") // Magnetostatic field tablesave()

barnex commented 6 years ago

RandomMagSeed(...), by design, returns the same configuration for the same seed. If you require different configurations, pass different seeds: RandomMagSeed(1) in file1, RandomMagSeed(2), in file2, etc. This design is intended to make simulations reproducible.

pankajmandal4003 commented 6 years ago

Thanks a lot for the solution!