diff --git a/mag/mfmkernel.go b/mag/mfmkernel.go index 603767496..4a76c7002 100644 --- a/mag/mfmkernel.go +++ b/mag/mfmkernel.go @@ -3,11 +3,12 @@ package mag import ( "bufio" "fmt" + "math" + "os" + d "github.com/mumax/3/data" "github.com/mumax/3/oommf" "github.com/mumax/3/util" - "math" - "os" ) func MFMKernel(mesh *d.Mesh, lift, tipsize float64, cacheDir string) (kernel [3]*d.Slice) { @@ -105,10 +106,10 @@ func CalcMFMKernel(mesh *d.Mesh, lift, tipsize float64) (kernel [3]*d.Slice) { { util.Assert(size[Z] >= 1 && size[Y] >= 2 && size[X] >= 2) util.Assert(cellsize[X] > 0 && cellsize[Y] > 0 && cellsize[Z] > 0) - util.AssertMsg(size[X]%2 == 0 && size[Y]%2 == 0, "Even kernel size needed") - if size[Z] > 1 { - util.AssertMsg(size[Z]%2 == 0, "Even kernel size needed") - } + // util.AssertMsg(size[X]%2 == 0 && size[Y]%2 == 0, "Even kernel size needed") + // if size[Z] > 1 { + // util.AssertMsg(size[Z]%2 == 0, "Even kernel size needed") + // } } // Allocate only upper diagonal part. The rest is symmetric due to reciprocity. diff --git a/test/mfm_sizes.mx3 b/test/mfm_sizes.mx3 new file mode 100644 index 000000000..960355ed8 --- /dev/null +++ b/test/mfm_sizes.mx3 @@ -0,0 +1,27 @@ +/* + Checks if MFM images can be saved for all thicknesses with and without PBC. + There was once a bug (#93) where Nz=2,3,4,5 could not generate an MFM image. +*/ + +Nx := 63 +Ny := 64 +c := 4e-9 + +Msat = 1 / mu0 +Aex = 10e-12 + +for Nz := 1; Nz < 12; Nz++ { + SetGridSize(Nx, Ny, Nz) + SetCellSize(c, c, c) + SetGeom(Zrange(-NZ*c/2, c/2).Intersect(Circle(Nx * c).Add(Xrange(-c*Nx/4, c*Nx/4)))) + m = vortex(1, 1) + SetPBC(0, 0, 0) + + SaveAs(m, sprintf("m_%d.ovf", Nz)) + + MFMLift = 40e-9 // forces the calculation of the MFM kernel. + SnapshotAs(MFM, sprintf("MFM_%d.jpg", Nz)) + SetPBC(2, 2, 0) + MFMLift = 40e-9 // forces the calculation of the MFM kernel. + SnapshotAs(MFM, sprintf("MFM_%d_PBC.jpg", Nz)) +}