mumax / 3

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

(Minor) Inconsistent behavior between m_full and m_full.Comp() when setgeom is used #322

Open jplauzie opened 1 year ago

jplauzie commented 1 year ago

Hi,

There seems to be a slight difference between the averaging method used to calculate the components of m_full vs m_full.Comp(). It seems the first averages over the entire universe, even after setgeom is called. Whereas the second respects the geometry, and averages over the geometry. A simple test script:

SetGridsize(100, 100, 1) SetCellsize(1e-9, 1e-9, 1e-9)

m=uniform(0,0,0)

setgeom( rect(50e-9,100e-9)) defregion(1,rect (50e-9,100e-9)) msat.setregion(1,500e3) m.setregion(1,uniform(1,0,0))

print(m_full) print(m_full.Comp(0))

yields output: 250000 0 0 and 500000 respectively.

If one doesn't use setgeom (for instance, instead defining the rectangular portion by using regions), they both yield 250000 as expected. An example being:

SetGridsize(100, 100, 1) SetCellsize(1e-9, 1e-9, 1e-9)

m=uniform(0,0,0)

defregion(1,rect (50e-9,100e-9)) msat.setregion(1,500e3) m.setregion(1,uniform(1,0,0))

print(m_full) print(m_full.Comp(0))

yields output: 250000 0 0 and 250000 respectively. Which makes sense, the geometry and the universe are the same since setgeom wasn't called.

mfullbug

Best, Josh Lauzier