Good afternoon,
I am trying to use mumax3 to run some simulations using a package called ubermag (
https://github.com/ubermag). I have added mumax to my PATH and my Python code, attached below, runs. However, I get the error you can see in the attached image and I can't pinpoint the source of the error. To my understanding, it seems to be in the mumax3 file itself but it seems far more likely that I have made some mistake in my code. For reference, I have downloaded mumax3.11.1 for CUDA 11.0 and I am running the programs on an ssh shell through my university cluster using CUDA 11.7.0 and an NVIDIA V100 or A100 GPU (depeneding on which one is available). I have attached the code of python program below, any help would be greatly appreciated.
#import libraries
import mumax3c as mc
import discretisedfield as df
import micromagneticmodel as mm
import random
import micromagneticdata as md
import numpy as np
import math
import k3d
from scipy.stats import multivariate_normal, norm
from scipy.fft import fft, ifft, fft2
import matplotlib.pyplot as plt
Ms = 1.375e5 #saturation magnetisation (A/m)
K_ = 1.37e4 #uniaxial anisotropy constant (J/m3)
K = 1.37e4 - 0.5*mm.consts.mu0*Ms**2 #shape anisotropy accounted for (J/m3)
A = 2.5e-13 #exchange energy constant (J/m)
u = (0,0,1) #easy axis
gamma = mm.consts.gamma #LLG precession term mu0 given by ubermag
gamma0 = mm.consts.gamma0
theta = 5*np.pi/180
Hmin_z = (-2e-4 / mm.consts.mu0,0,-0.05 / mm.consts.mu0)
Hmax_z = (2e-4 / mm.consts.mu0,0,0.05 / mm.consts.mu0)
Hmin_x = (-0.05/ mm.consts.mu0, 0, -2e-4 / mm.consts.mu0)
Hmax_x = (0.05/ mm.consts.mu0, 0, 2e-4 / mm.consts.mu0)
n = 41 #number of points at which measurements are made
system = mm.System(name="CGT_td_flake_r")
p1 = (0,0,0)
p2 = (3e-6,5e-6,10.5e-9)
region = df.Region(p1 = p1, p2 = p2) #defines rectangular region for slab
cell = (5e-9, 5e-9, 0.7e-9)
mesh = df.Mesh(region = region, cell = cell, bc = "xy")
random.seed(1) #Setting a seed makes sure that every time the cell is run the same values are generated
def m_fun(pos): #Defines orientation of for dipoles randomly
return [2*random.random()-1 for i in range(3)]
#hd = mc.HysteresisDriver()
td = mc.TimeDriver()
def Ms_flake_r(position):
x,y,z = position
if y> (8.601/2)*1e-6 - 38.2276*x and y < (13.761/2)*1e-6 - 2.3899*x and y > (3.137/2)*1e-6 - 0.544807*x and y < 0.415987*x + (8.601/2)*1e-6:
return Ms
else:
return 0
def Ms_gauss_r(position):
x,y,z = position
if y> (8.601/2)*1e-6 - 38.2276*x and y < (13.761/2)*1e-6 - 2.3899*x and y > (3.137/2)*1e-6 - 0.544807*x and y < 0.415987*x + (8.601/2)*1e-6:
mean = np.array([1000e-9, 2000e-9])
sd = 2e-13
cov = np.array([[sd, 0], [0, sd]])
rv = multivariate_normal(mean, cov)
pdf = rv.pdf((x,y))
offset = pdf*2*np.pi*sd*np.sin(theta)
return (offset, 0, np.sqrt(1-offset**2))
else:
return (0,0,1)
def alpha_fun(position):
x,y,z = position
if y> (8.601/2)*1e-6 - 38.2276*(x-0.1e-6) and y < (13.761/2)*1e-6 - 2.3899*(x+0.1e-6) and y > (3.137/2)*1e-6 - 0.544807*(x-0.1e-6) and y < (8.601/2)*1e-6 + 0.415987*(x-0.1e-6):
return 1e-4
else:
return 1
alpha_field = df.Field(mesh, nvdim=1, value=alpha_fun)
H = (0, 0, 1 / mm.consts.mu0)
system.energy = (
mm.Exchange(A = A)
+ mm.UniaxialAnisotropy(K = K, u = u)
#+ mm.Demag()
+ mm.Zeeman(H = H)
#+ mm.DMI(D=1e-3, crystalclass="T")
)
system.dynamics = mm.Damping(alpha = alpha_field) + mm.Precession(gamma0 = gamma)
system.m = df.Field(mesh, nvdim=3, value = Ms_gauss_r, norm=Ms_flake_r, valid="norm")
system.m.z.sel("z").mpl.scalar()
td.drive(system, t=1e-12, n=100)