ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

Space and Time dependent Uniaxial Anisotropy-urgent* #259

Closed vinodnaikb closed 1 year ago

vinodnaikb commented 1 year ago

Good Morning @swapneelap @lang-m I tried implementing Uniaxial anisotropy which is space and time-dependent in the following way.

K=1e5

def t_fun(t):
     if t<1e-9:
           return 0
     else:
           return 1

def fun(pos):
     x,y,z=pos
     f=x/1e-9
     return f

u=df.Field(mesh, dim=3, value=fun)

system.energy=mm.UniaxialAnisotropy(K=K, u=u, func=t_fun, dt=1e-12)

I'm getting the error "Invalid attribute key='func' Is it not possible to have time dependence for Uniaxial anisotropy

lang-m commented 1 year ago

Hi @vinodnaikb time-dependend anisotropy is in general not supported.

However, as you have a simple step function, i.e. just turn it on a some point you can run two consecutive simulations and add anisotropy before the second run (similar to what is documented for an external magnetic field here: https://ubermag.github.io/examples/notebooks/time-dependent-field-current.html#How-to-properly-simulate-this-field-pulse).